Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / bimap / detail / manage_bimap_key.hpp
1 // Boost.Bimap
2 //
3 // Copyright (c) 2006-2007 Matias Capeletto
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 /// \file detail/manage_bimap_key.hpp
10 /// \brief Utility class to manage the set types of a bimap.
11
12 #ifndef BOOST_BIMAP_DETAIL_MANAGE_BIMAP_KEY_HPP
13 #define BOOST_BIMAP_DETAIL_MANAGE_BIMAP_KEY_HPP
14
15 #if defined(_MSC_VER) && (_MSC_VER>=1200)
16 #pragma once
17 #endif
18
19 #include <boost/config.hpp>
20
21 #include <boost/mpl/eval_if.hpp>
22 #include <boost/mpl/identity.hpp>
23
24 #include <boost/bimap/detail/is_set_type_of.hpp>
25
26 #include <boost/bimap/set_of.hpp>
27
28 namespace boost {
29 namespace bimaps {
30 namespace detail {
31
32 /** \struct boost::bimaps::detail::manage_bimap_key
33 \brief Metafunction to manage the set types of a bimap.
34
35 \code
36 template< class Type >
37 struct manage_bimap_key
38 {
39     typedef -SetType- type;
40 }
41 \endcode
42
43 See also bimap, bimap_core.
44                                                                                 **/
45
46 #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
47
48 template< class Type >
49 struct manage_bimap_key
50 {
51
52 typedef BOOST_DEDUCED_TYPENAME
53
54     mpl::eval_if< BOOST_DEDUCED_TYPENAME is_set_type_of< Type >::type,
55     // {
56             mpl::identity< Type >,
57     // }
58     // else
59     // {
60             // Default it to a set
61             mpl::identity< set_of< Type > >
62     // }
63
64     >::type set_type;
65
66     // Returns set_type and evaluate the concept_checked_type
67
68     typedef BOOST_DEDUCED_TYPENAME mpl::if_c< true, set_type, 
69         BOOST_DEDUCED_TYPENAME set_type::lazy_concept_checked::type
70     >::type type;
71 };
72
73
74
75 #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
76
77 } // namespace detail
78 } // namespace bimaps
79 } // namespace boost
80
81
82 #endif // BOOST_BIMAP_DETAIL_MANAGE_BIMAP_KEY_HPP
83
84