link_ext_test.cpp 948 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2006-2009 Daniel James.
  2. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #include "./config.hpp"
  5. #define BOOST_HASH_TEST_NAMESPACE boost
  6. #include <boost/container_hash/hash.hpp>
  7. #include <boost/core/lightweight_test.hpp>
  8. #include <vector>
  9. int f(std::size_t hash1, int* x1) {
  10. // Check that BOOST_HASH_TEST_NAMESPACE::hash<int*> works in both files.
  11. BOOST_HASH_TEST_NAMESPACE::hash<int*> ptr_hasher;
  12. BOOST_TEST(hash1 == ptr_hasher(x1));
  13. #if defined(BOOST_HASH_TEST_EXTENSIONS)
  14. // Check that std::vector<std::size_t> is avaiable in this file.
  15. std::vector<std::size_t> x;
  16. x.push_back(static_cast<std::size_t>(*x1));
  17. BOOST_HASH_TEST_NAMESPACE::hash<std::vector<std::size_t> > vector_hasher;
  18. return vector_hasher(x) != BOOST_HASH_TEST_NAMESPACE::hash_value(x);
  19. #else
  20. return 0;
  21. #endif
  22. }