summaryrefslogtreecommitdiff
path: root/src/vector.hh
blob: c87c8aa8a6364854604a2c7f08b618a6dd557fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef vector_hh_INCLUDED
#define vector_hh_INCLUDED

#include "memory.hh"
#include "hash.hh"

#include <vector>

namespace Kakoune
{

template<typename T, MemoryDomain domain = memory_domain(Meta::Type<T>{})>
using Vector = std::vector<T, Allocator<T, domain>>;

template<typename T, MemoryDomain domain>
size_t hash_value(const Vector<T, domain>& vector)
{
    size_t hash = 0x1235678;
    for (auto&& elem : vector)
        hash = combine_hash(hash, hash_value(elem));
    return hash;
}

}

#endif // vector_hh_INCLUDED