metafunctions.hpp 939 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2005-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. #if !defined(BOOST_UNORDERED_TEST_HELPERS_METAFUNCTIONS_HEADER)
  5. #define BOOST_UNORDERED_TEST_HELPERS_METAFUNCTIONS_HEADER
  6. #include <boost/config.hpp>
  7. #include <boost/type_traits/is_same.hpp>
  8. namespace test {
  9. template <class Container>
  10. struct is_set : public boost::is_same<typename Container::key_type,
  11. typename Container::value_type>
  12. {
  13. };
  14. template <class Container> struct has_unique_keys
  15. {
  16. static char flip(typename Container::iterator const&);
  17. static long flip(std::pair<typename Container::iterator, bool> const&);
  18. BOOST_STATIC_CONSTANT(bool,
  19. value = sizeof(long) ==
  20. sizeof(flip(
  21. ((Container*)0)->insert(*(typename Container::value_type*)0))));
  22. };
  23. }
  24. #endif