From ca41ca8f9a6b21588248e5fee1a013363f3f52a8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 13 Mar 2015 14:34:24 +0200 Subject: Add support for "first" and "last" execution modes --- build/key-set | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'build/key-set') diff --git a/build/key-set b/build/key-set index 8c197b8..1d0b532 100644 --- a/build/key-set +++ b/build/key-set @@ -5,6 +5,9 @@ #ifndef BUILD_KEY_SET #define BUILD_KEY_SET +#include // declval() +#include // hash + namespace build { // Google the "Emulating Boost.MultiIndex with Standard Containers" blog @@ -18,6 +21,7 @@ namespace build set_key (const T* v = 0): p (v) {} bool operator< (const set_key& x) const {return *p < *x.p;} + bool operator== (const set_key& x) const {return *p == *x.p;} }; template @@ -38,4 +42,18 @@ namespace build }; } +namespace std +{ + template + struct hash>: hash + { + size_t + operator() (build::set_key x) const + noexcept (noexcept (declval> () (*x.p))) + { + return hash::operator() (*x.p); + } + }; +} + #endif // BUILD_KEY_SET -- cgit v1.1