|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78755 - trunk/libs/functional/hash/test
From: dnljms_at_[hidden]
Date: 2012-05-29 15:41:20
Author: danieljames
Date: 2012-05-29 15:41:19 EDT (Tue, 29 May 2012)
New Revision: 78755
URL: http://svn.boost.org/trac/boost/changeset/78755
Log:
Hash: Only use typeid when available.
Text files modified:
trunk/libs/functional/hash/test/hash_type_index_test.cpp | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
Modified: trunk/libs/functional/hash/test/hash_type_index_test.cpp
==============================================================================
--- trunk/libs/functional/hash/test/hash_type_index_test.cpp (original)
+++ trunk/libs/functional/hash/test/hash_type_index_test.cpp 2012-05-29 15:41:19 EDT (Tue, 29 May 2012)
@@ -18,12 +18,16 @@
#include <typeindex>
void test_type_index() {
+ HASH_NAMESPACE::hash<std::type_index> hasher;
+
+#if defined(BOOST_NO_TYPEID)
+ std::cout<<"Unable to test std::type_index, as typeid isn't available"
+ <<std::endl;
+#else
std::type_index int_index = typeid(int);
std::type_index int2_index = typeid(int);
std::type_index char_index = typeid(char);
- HASH_NAMESPACE::hash<std::type_index> hasher;
-
BOOST_TEST(hasher(int_index) == int_index.hash_code());
BOOST_TEST(hasher(int_index) == int2_index.hash_code());
BOOST_TEST(hasher(char_index) == char_index.hash_code());
@@ -33,6 +37,7 @@
BOOST_TEST(hasher(int_index) == hasher(int2_index));
BOOST_TEST(hasher(int_index) != hasher(char_index));
+#endif
}
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk