Go to the documentation of this file.
28 #include <boost/functional/hash.hpp>
36 #define ARMARX_IDENTITY(...) __VA_ARGS__
41 #define ARMARX_STRIP_PARENTHESES(X) ARMARX_IDENTITY X
49 #define ARMARX_OVERLOAD_STD_HASH(Type, Members) \
53 struct hash<ARMARX_STRIP_PARENTHESES(Type)> \
55 using argument_type = ARMARX_STRIP_PARENTHESES(Type); \
56 using result_type = std::size_t; \
58 operator()(argument_type const& arg) const \
60 return armarx::hash_all(ARMARX_STRIP_PARENTHESES(Members)); \
74 #define ARMARX_OVERLOAD_STD_HASH_FOR_ITERABLE(TemplateArgs, Type) \
77 template <ARMARX_STRIP_PARENTHESES(TemplateArgs)> \
78 struct hash<ARMARX_STRIP_PARENTHESES(Type)> \
80 using argument_type = ARMARX_STRIP_PARENTHESES(Type); \
81 using result_type = std::size_t; \
83 operator()(argument_type const& arg) const \
85 return boost::hash_range(arg.begin(), arg.end()); \
99 do_hash(std::size_t& hashed,
const T0& t0)
103 boost::hash_combine(hashed, t0);
112 template <
class T0,
class... Ts>
114 do_hash(std::size_t& hashed,
const T0& t0,
const Ts&... ts)
125 template <
class... Ts>
129 std::size_t hashed = 0;
143 template <
class... Ts>
144 struct hash<tuple<Ts...>>
175 template <
class A,
class B>
176 struct hash<pair<
A, B>>
pair< A, B > argument_type
the hash operator's argument type.
std::size_t result_type
the hash operator's result type
void do_hash(std::size_t &hashed, const T0 &t0)
Combines the accumulated hash and the parameters hash.
result_type operator()(argument_type const &arg) const
Hashes a tuple.
result_type operator()(argument_type const &arg) const
Hashes a pair.
#define ARMARX_OVERLOAD_STD_HASH_FOR_ITERABLE(TemplateArgs, Type)
Overloads the std::hash template for a type Type with the member functions begin() and end().
std::size_t result_type
the hash operator's result type
tuple< Ts... > argument_type
the hash operator's argument type.
class A(deque< T, A >)) ARMARX_OVERLOAD_STD_HASH_FOR_ITERABLE((class T
Enables hashing of std::list.
std::size_t hash_all(const Ts &... ts)
Returns the hash of all parameters.
This file offers overloads of toIce() and fromIce() functions for STL container types.