diff --git a/research/try.cpp b/research/try.cpp index b13321066..5939c4f08 100644 --- a/research/try.cpp +++ b/research/try.cpp @@ -124,6 +124,33 @@ namespace std { #include + + +namespace lib { +namespace meta { + + namespace { + struct NoUsableHashDefinition { size_t more_than_one[2]; }; + typedef size_t HasUsableHashDefinition; + + NoUsableHashDefinition hash_value(...); + + } + + template + class provides_BoostHashFunction + { + TY const& unusedDummy = *(TY*)nullptr; + + public: + enum{ value = (sizeof(HasUsableHashDefinition) == sizeof(hash_value(unusedDummy))) }; + }; +}} + +#include + + + //#include #include #include @@ -197,6 +224,8 @@ main (int, char**) << "\n (boost) = " << boo_stringHasher(p) <<"|"<< boo_stringHasher(pp) << "\n custom hash (std) " << std_customHasher(s) <<"|"<< std_customHasher(ss) << "\n custom hash (boost) " << boo_customHasher(v) <<"|"<< boo_customHasher(vv) + << "\n has_boost_hash " << lib::meta::provides_BoostHashFunction::value + << "\n has_boost_hash " << lib::meta::provides_BoostHashFunction::value // << "\n use std from boost: " << std2boo_crossHar(s) <<"|"<< std2boo_crossHar(ss) // << "\n use boost from std: " << boo2std_crossHar(v) <<"|"<< boo2std_crossHar(vv) ;