CGRA-ME
|
#include <TupleHash.h>
Classes | |
struct | Hash |
Public Member Functions | |
const Derived & | asDerived () const |
Derived & | asDerived () |
bool | operator== (const Derived &rhs) const |
bool | operator< (const Derived &rhs) const |
Help for making your simple struct hashable. Provides a constructor that takes one argument for each member exposed through asTuple().
ex:
struct MyStruct : tuple_hash::TupleHashOps<MyStruct> { // be sure update the template parameter to the base class int i,j;
MyStruct(int i, int j) : i(i), j(j) { } // required until c++17 (inheriting precludes aggregate property) auto asTuple() const { return std::make_tuple(i,j); } // all you have to do is provide this function. Retuning std::tie is fine. };
std::unordered_map<MyStruct, int, MyStruct::Hash> myMap; mySet.emplace(MyStruct{1,1}, 1);
Definition at line 94 of file TupleHash.h.
|
inline |
Definition at line 96 of file TupleHash.h.
|
inline |
Definition at line 95 of file TupleHash.h.
|
inline |
Definition at line 99 of file TupleHash.h.
|
inline |
Definition at line 98 of file TupleHash.h.