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