test_common.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2015-2015.
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/intrusive for documentation.
  10. //
  11. /////////////////////////////////////////////////////////////////////////////
  12. #ifndef BOOST_INTRUSIVE_TEST_TEST_COMMON_HPP
  13. #define BOOST_INTRUSIVE_TEST_TEST_COMMON_HPP
  14. #include <boost/intrusive/bs_set_hook.hpp>
  15. #include <boost/intrusive/detail/mpl.hpp>
  16. #include "bptr_value.hpp"
  17. namespace boost {
  18. namespace intrusive {
  19. template <class KeyOfValueOption, class Map>
  20. struct key_type_tester
  21. {
  22. struct empty_default{};
  23. typedef typename pack_options< empty_default, KeyOfValueOption >::type::key_of_value key_of_value_t;
  24. BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< KeyOfValueOption
  25. , key_of_value<int_holder_key_of_value<typename Map::value_type> >
  26. >::value ));
  27. BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< key_of_value_t
  28. , int_holder_key_of_value<typename Map::value_type>
  29. >::value ));
  30. BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< typename Map::key_type
  31. , typename key_of_value_t::type >::value ));
  32. BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< typename Map::key_of_value
  33. , key_of_value_t >::value ));
  34. static const bool value = true;
  35. };
  36. template <class Map>
  37. struct key_type_tester<void, Map>
  38. {
  39. BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< typename Map::key_type
  40. , typename Map::value_type
  41. >::value ));
  42. BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< typename Map::key_of_value
  43. , boost::intrusive::detail::identity< typename Map::value_type>
  44. >::value ));
  45. static const bool value = true;
  46. };
  47. } //namespace intrusive {
  48. } //namespace boost {
  49. #endif //BOOST_INTRUSIVE_TEST_TEST_COMMON_HPP