Chris@16
|
1 // Boost.Bimap
|
Chris@16
|
2 //
|
Chris@16
|
3 // Copyright (c) 2006-2007 Matias Capeletto
|
Chris@16
|
4 //
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
6 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 /// \file relation/symmetrical_base.hpp
|
Chris@16
|
10 /// \brief Base class for symmetrical types
|
Chris@16
|
11
|
Chris@16
|
12 #ifndef BOOST_BIMAP_RELATION_SYMMETRICAL_BASE_HPP
|
Chris@16
|
13 #define BOOST_BIMAP_RELATION_SYMMETRICAL_BASE_HPP
|
Chris@16
|
14
|
Chris@101
|
15 #if defined(_MSC_VER)
|
Chris@16
|
16 #pragma once
|
Chris@16
|
17 #endif
|
Chris@16
|
18
|
Chris@16
|
19 #include <boost/config.hpp>
|
Chris@16
|
20
|
Chris@16
|
21 #include <boost/mpl/if.hpp>
|
Chris@16
|
22 #include <boost/type_traits/remove_const.hpp>
|
Chris@16
|
23
|
Chris@16
|
24 // Boost.Bimap
|
Chris@16
|
25 #include <boost/bimap/tags/tagged.hpp>
|
Chris@16
|
26 #include <boost/bimap/tags/support/default_tagged.hpp>
|
Chris@16
|
27
|
Chris@16
|
28 #include <boost/bimap/relation/member_at.hpp>
|
Chris@16
|
29
|
Chris@16
|
30
|
Chris@16
|
31 namespace boost {
|
Chris@16
|
32 namespace bimaps {
|
Chris@16
|
33 namespace relation {
|
Chris@16
|
34
|
Chris@16
|
35 /// \brief Base of symetrical tagged types.
|
Chris@16
|
36 /**
|
Chris@16
|
37
|
Chris@16
|
38 **/
|
Chris@16
|
39
|
Chris@16
|
40 template< class TA, class TB, bool force_mutable = false >
|
Chris@16
|
41 class symmetrical_base
|
Chris@16
|
42 {
|
Chris@16
|
43
|
Chris@16
|
44 public:
|
Chris@16
|
45
|
Chris@16
|
46 typedef BOOST_DEDUCED_TYPENAME tags::support::default_tagged
|
Chris@16
|
47 <
|
Chris@16
|
48 TA,
|
Chris@16
|
49 member_at::left
|
Chris@16
|
50
|
Chris@16
|
51 >::type tagged_left_type;
|
Chris@16
|
52
|
Chris@16
|
53 typedef BOOST_DEDUCED_TYPENAME tags::support::default_tagged
|
Chris@16
|
54 <
|
Chris@16
|
55 TB,
|
Chris@16
|
56 member_at::right
|
Chris@16
|
57
|
Chris@16
|
58 >::type tagged_right_type;
|
Chris@16
|
59
|
Chris@16
|
60 public:
|
Chris@16
|
61
|
Chris@16
|
62 //@{
|
Chris@16
|
63 /// The type stored in the relation
|
Chris@16
|
64
|
Chris@16
|
65 typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< force_mutable,
|
Chris@16
|
66
|
Chris@16
|
67 BOOST_DEDUCED_TYPENAME ::boost::remove_const<
|
Chris@16
|
68 BOOST_DEDUCED_TYPENAME tagged_left_type::value_type >::type,
|
Chris@16
|
69 BOOST_DEDUCED_TYPENAME tagged_left_type::value_type
|
Chris@16
|
70
|
Chris@16
|
71 >::type left_value_type;
|
Chris@16
|
72
|
Chris@16
|
73 typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< force_mutable,
|
Chris@16
|
74
|
Chris@16
|
75 BOOST_DEDUCED_TYPENAME ::boost::remove_const<
|
Chris@16
|
76 BOOST_DEDUCED_TYPENAME tagged_right_type::value_type >::type,
|
Chris@16
|
77 BOOST_DEDUCED_TYPENAME tagged_right_type::value_type
|
Chris@16
|
78
|
Chris@16
|
79 >::type right_value_type;
|
Chris@16
|
80 //@}
|
Chris@16
|
81
|
Chris@16
|
82 //@{
|
Chris@16
|
83 /// The tag of the member. By default it is \c member_at::{side}
|
Chris@16
|
84 typedef BOOST_DEDUCED_TYPENAME tagged_left_type ::tag left_tag;
|
Chris@16
|
85 typedef BOOST_DEDUCED_TYPENAME tagged_right_type::tag right_tag;
|
Chris@16
|
86 //@}
|
Chris@16
|
87 };
|
Chris@16
|
88
|
Chris@16
|
89
|
Chris@16
|
90
|
Chris@16
|
91 } // namespace relation
|
Chris@16
|
92 } // namespace bimaps
|
Chris@16
|
93 } // namespace boost
|
Chris@16
|
94
|
Chris@16
|
95
|
Chris@16
|
96 #endif // BOOST_BIMAP_RELATION_SYMMETRICAL_BASE_HPP
|
Chris@16
|
97
|