-
Notifications
You must be signed in to change notification settings - Fork 13
/
requirements.txt
125 lines (101 loc) · 6.39 KB
/
requirements.txt
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
HashAlgorithm (hash algorithm) Requirements:
Has nested type result_type (std::size_t when used with std::unordered_*).
Constructible (default and/or seeded) // initialization
Effects: Initializes the state of the HashAlgorithm. After default
constructing two HashAlgorithm's, h1 and h2, h1 and h2 shall
have the same state. If two HashAlgorithm's h1 and h2 are
constructed with the same seeds, h1 and h2 shall have
the same state.
HashAlgorithm(HashAlgorithm const& h)
Effects: After construction *this and h have the same state. However
subsequent updates to *this will not affect the state of h,
and vice-versa.
HashAlgorithm& operator=(HashAlgorithm const& h)
Effects: After the assignment, *this and h have the same state.
Returns: *this. However subsequent updates to *this will not affect
the state of h, and vice-versa.
void operator()(void const* key, std::size_t len) ; // update operation
Requires: if len > 0, key points to len contiguous bytes to
be consumed by the HashAlgorithm. The finalize operation
has not been called on this object since construction,
or since *this was assigned to.
Effects: Updates the state of the hasher using the len bytes
referred to by {key, len} pair.
If for two keys {k1, len1} and {k2, len2}, both len1 and
len2 == 0, then the two keys are considered equivalent. If
len1 != len2, the two keys are considered not equivalent.
If len1 == len2 and len1 > 0, and if memcmp(k1, k2, len1)
== 0, the two keys are equivalent, else they are not
equivalent. If two instances of HashAlgorithm (e.g. h1 and h2)
have the same state prior to an update operation, and given
two equivalent keys {k1, len} and {k2, len}, then after
h1(k1, len) and h2(k2, len), then h1 and h2 shall have
the same updated state.
The HashAlgorithm does not access this memory range after the
update operation returns. [Note: If len == 0, then key may
be nullptr. If len == 0, it is unspecified if the state of
the HashAlgorithm is changed during the update. -- end note]
explicit operator result_type(); // finalize operation
Requires: This operation has not been called on this object
since construction or since *this was assigned to.
Effects: Converts the state of the HashAlgorithm to a result_type. Two
instances of the same type of HashAlgorithm, with the same state,
shall return the same value. It is unspecified if this
operation changes the state of the HashAlgorithm.
Returns: The converted state.
Hash_functor<HashAlgorithm> Requirements:
using result_type = typename HashAlgorithm::result_type;
Constructible (default and/or seeded) // initialization
Effects: Initializes the state of the Hash_functor. A Hash_functor
may be stateless or have state. If not stateless, different
default constructions, and different seeded constructions
(even with the same seeds), are not required to initialize
the Hash_functor to the same state.
Hash_functor(Hash_functor const& hf)
Effects: After construction *this and hf have the same state.
Hash_functor& operator=(Hash_functor const& hf)
Effects: After the assignment, *this and hf have the same state.
Returns: *this.
template <class T>
result_type
operator()(T const& t) const;
Requires: HashAlgorithm shall be constructible as specified by a concrete
Hash_functor type.
Effects: Constructs a HashAlgorithm h with automatic storage. Each concrete
Hash_functor type shall specifiy how h is constructed.
However h shall be constructed to the same state for every
invocation of (*this)(t). Updates the state of the HashAlgorithm
in an unspecified manner, except that there shall be
exactly one call to:
using std::hash_append;
hash_append(h, t);
at some time during the update operation. Furthermore,
subsequent calls shall update the the local h with exactly
the same state every time, except as changed by different
values for t, unless there is an intervening assignment to
*this between calls to this operator.
Returns: static_cast<result_type>(h).
[Note: For the same value of t, the same value is returned
on subsequent calls unless there is an intervening
assignment to *this between calls to this operator. -- end
note]
template <class HashAlgorithm>
void
hash_append(HashAlgorithm& h, X const& x);
Requires: hash_append shall be declared in the same namespace in which X
is declared. HashAlgorithm shall meet the HashAlgorithm requirements. If for
two values of X, x1 and x2, and given two values of type HashAlgorithm,
h1 and h2, where h1 and h2 have the same state, then if x1 == x2
then after hash_append(h1, x1) and hash_append(h2, x2), h1 and
h2 shall have the same updated state.
Effects: Updates the state of h with the value of x. Different values of
x should update h to different states. This may be done by
calling h(void*, size_t), and / or by calling hash_append
(unqualified) on h and sub-objects of x, or by calling
hash_append on h and some value computed from the value of x.
is_contiguously_hashable<T>:
A type T is contiguously hashable if for all combinations of two values of a
type, say x and y, if x == y, then it must also be true that
memcmp(addressof(x), addressof(y), sizeof(T)) == 0.
template <class T> struct is_contiguously_hashable<T> derives from true_type
if T is contiguously hashable, else it derives from false_type.