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;\
57 result_type operator()(argument_type const& arg) const\
59 return armarx::hash_all( ARMARX_STRIP_PARENTHESES(Members) );\
73 #define ARMARX_OVERLOAD_STD_HASH_FOR_ITERABLE(TemplateArgs, Type)\
76 template< ARMARX_STRIP_PARENTHESES(TemplateArgs) >\
77 struct hash< ARMARX_STRIP_PARENTHESES(Type) >\
79 using argument_type = ARMARX_STRIP_PARENTHESES(Type);\
80 using result_type = std::size_t;\
81 result_type operator()(argument_type const& arg) const\
83 return boost::hash_range(arg.begin(), arg.end());\
96 void do_hash(std::size_t& hashed,
const T0& t0)
100 boost::hash_combine(hashed, t0);
109 template<
class T0,
class...Ts>
110 void do_hash(std::size_t& hashed,
const T0& t0,
const Ts& ...ts)
124 std::size_t hashed = 0;
138 struct hash<tuple<Ts...>>
166 template<
class A,
class B>
167 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.
std::size_t hash_all(const Ts &...ts)
Returns the hash of all parameters.
class A(deque< T, A >)) ARMARX_OVERLOAD_STD_HASH_FOR_ITERABLE((class T
Enables hashing of std::list.
This file offers overloads of toIce() and fromIce() functions for STL container types.