From f102d684cf51ab48936a5f1aca87c4efa242bdaa Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 7 Apr 2005 22:14:02 +0000 Subject: [PATCH] Implement the compile time checks for hash functions as a function instead of a templated class. Hopefully it will work on more compilers. [SVN r28053] --- hash/test/compile_time.hpp | 3 +-- hash/test/hash_number_test.cpp | 2 +- hash/test/hash_pointer_test.cpp | 4 ++-- hash/test/hash_string_test.cpp | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hash/test/compile_time.hpp b/hash/test/compile_time.hpp index 646d42b..cd54183 100644 --- a/hash/test/compile_time.hpp +++ b/hash/test/compile_time.hpp @@ -8,10 +8,9 @@ #include template -struct compile_time_tests +void compile_time_tests(T*) { BOOST_MPL_ASSERT((boost::is_base_and_derived< std::unary_function, HASH_NAMESPACE::hash >)); - BOOST_STATIC_CONSTANT(bool, success = true); }; diff --git a/hash/test/hash_number_test.cpp b/hash/test/hash_number_test.cpp index af1accb..b9a3a74 100644 --- a/hash/test/hash_number_test.cpp +++ b/hash/test/hash_number_test.cpp @@ -24,7 +24,7 @@ template void numeric_test() { - BOOST_CHECK(compile_time_tests::success); + compile_time_tests((T*) 0); HASH_NAMESPACE::hash x1; HASH_NAMESPACE::hash x2; diff --git a/hash/test/hash_pointer_test.cpp b/hash/test/hash_pointer_test.cpp index 2d661b4..9fe1247 100644 --- a/hash/test/hash_pointer_test.cpp +++ b/hash/test/hash_pointer_test.cpp @@ -23,8 +23,8 @@ BOOST_AUTO_UNIT_TEST(pointer_tests) { - BOOST_CHECK(compile_time_tests::success); - BOOST_CHECK(compile_time_tests::success); + compile_time_tests((int**) 0); + compile_time_tests((void**) 0); HASH_NAMESPACE::hash x1; HASH_NAMESPACE::hash x2; diff --git a/hash/test/hash_string_test.cpp b/hash/test/hash_string_test.cpp index ae55682..f1daf8d 100644 --- a/hash/test/hash_string_test.cpp +++ b/hash/test/hash_string_test.cpp @@ -22,7 +22,7 @@ BOOST_AUTO_UNIT_TEST(string_tests) { - BOOST_CHECK(compile_time_tests::success); + compile_time_tests((std::string*) 0); HASH_NAMESPACE::hash x1; HASH_NAMESPACE::hash x2; @@ -34,7 +34,7 @@ BOOST_AUTO_UNIT_TEST(string_tests) #if !defined(BOOST_NO_STD_WSTRING) BOOST_AUTO_UNIT_TEST(wstring_tests) { - BOOST_CHECK(compile_time_tests::success); + compile_time_tests((std::wstring*) 0); HASH_NAMESPACE::hash x1; HASH_NAMESPACE::hash x2;