diff options
Diffstat (limited to 'libs/flyweight/test/test_basic_template.hpp')
-rw-r--r-- | libs/flyweight/test/test_basic_template.hpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/flyweight/test/test_basic_template.hpp b/libs/flyweight/test/test_basic_template.hpp index 3a4f423b3..191374471 100644 --- a/libs/flyweight/test/test_basic_template.hpp +++ b/libs/flyweight/test/test_basic_template.hpp @@ -28,6 +28,14 @@ #include <utility> #endif +#if !defined(BOOST_FLYWEIGHT_DISABLE_HASH_SUPPORT) +#include <boost/functional/hash.hpp> + +#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) +#include <functional> +#endif +#endif + #define LENGTHOF(array) (sizeof(array)/sizeof((array)[0])) template<typename Flyweight,typename ForwardIterator> @@ -104,6 +112,21 @@ void test_basic_template( std::ostringstream oss2; oss2<<f1.get(); BOOST_TEST(oss1.str()==oss2.str()); + +#if !defined(BOOST_FLYWEIGHT_DISABLE_HASH_SUPPORT) + + /* hash support */ + + BOOST_TEST(boost::hash<Flyweight>()(f1)==boost::hash<Flyweight>()(c1)); + BOOST_TEST(boost::hash<Flyweight>()(f1)== + boost::hash<const value_type*>()(&f1.get())); + +#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + BOOST_TEST(std::hash<Flyweight>()(f1)==std::hash<Flyweight>()(c1)); + BOOST_TEST(std::hash<Flyweight>()(f1)== + std::hash<const value_type*>()(&f1.get())); +#endif +#endif } } |