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 
15 #include <boost/intrusive/bs_set_hook.hpp>
16 #include <boost/intrusive/detail/mpl.hpp>
17 #include "bptr_value.hpp"
18 
19 namespace boost {
20 namespace intrusive {
21 
22 template <class KeyOfValueOption, class Map>
23 struct key_type_tester
24 {
25    struct empty_default{};
26    typedef typename pack_options< empty_default, KeyOfValueOption >::type::key_of_value key_of_value_t;
27 
28    BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< KeyOfValueOption
29                                                           , key_of_value<int_holder_key_of_value<typename Map::value_type> >
30                                                           >::value ));
31    BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< key_of_value_t
32                                                           , int_holder_key_of_value<typename Map::value_type>
33                                                           >::value ));
34    BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< typename Map::key_type
35                                                           , typename key_of_value_t::type >::value ));
36    BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< typename Map::key_of_value
37                                                           , key_of_value_t >::value ));
38    static const bool value = true;
39 };
40 
41 template <class Map>
42 struct key_type_tester<void, Map>
43 {
44    BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< typename Map::key_type
45                                                           , typename Map::value_type
46                                                           >::value ));
47 
48    BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same< typename Map::key_of_value
49                                                          , boost::intrusive::detail::identity< typename Map::value_type>
50                                                          >::value ));
51    static const bool value = true;
52 };
53 
54 }  //namespace intrusive {
55 }  //namespace boost {
56 
57 #endif //BOOST_INTRUSIVE_TEST_TEST_COMMON_HPP
58