3 // Copyright (c) 2006-2007 Matias Capeletto
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)
9 /// \file relation/detail/access_builder.hpp
10 /// \brief Define macros to help building metafunctions
12 #ifndef BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP
13 #define BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP
15 #if defined(_MSC_VER) && (_MSC_VER>=1200)
19 #include <boost/config.hpp>
21 #include <boost/bimap/relation/support/member_with_tag.hpp>
22 #include <boost/bimap/relation/member_at.hpp>
23 #include <boost/call_traits.hpp>
24 #include <boost/type_traits/is_const.hpp>
25 #include <boost/mpl/if.hpp>
26 #include <boost/mpl/not.hpp>
27 #include <boost/utility/enable_if.hpp>
30 /******************************************************************************
31 BIMAP SYMMETRIC ACCESS RESULT OF
32 *******************************************************************************
36 template< class Tag, class SymmetricType >
39 typedef -unspecified- type;
42 } // namespace result_of
44 ******************************************************************************/
46 /*===========================================================================*/
47 #define BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER( \
53 namespace result_of { \
55 template< class Tag, class SymmetricType > \
58 typedef BOOST_DEDUCED_TYPENAME METAFUNCTION_BASE \
64 typedef BOOST_DEDUCED_TYPENAME mpl::if_< is_const<SymmetricType>, \
66 BOOST_DEDUCED_TYPENAME call_traits<value_type>::const_reference, \
68 BOOST_DEDUCED_TYPENAME call_traits<value_type>::reference \
74 /*===========================================================================*/
78 /******************************************************************************
79 BIMAP SYMMETRIC ACCESS IMPLEMENTATION
80 *******************************************************************************
84 template< class Tag, class SymmetricType >
85 typename result_of::NAME<Tag,SymmetricType>::type
86 NAME( Tag , const Relation & );
90 ******************************************************************************/
93 /*===========================================================================*/
94 #define BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER( \
107 template< class TP_SYMMETRIC > \
108 BOOST_DEDUCED_TYPENAME result_of::NAME \
110 ::boost::bimaps::relation::member_at::left,TP_SYMMETRIC \
114 NAME( ::boost::bimaps::relation::member_at::left, \
115 TP_SYMMETRIC & PARAMETER_NAME ) \
120 template< class TP_SYMMETRIC > \
121 BOOST_DEDUCED_TYPENAME result_of::NAME \
123 ::boost::bimaps::relation::member_at::right,TP_SYMMETRIC \
127 NAME( ::boost::bimaps::relation::member_at::right, \
128 TP_SYMMETRIC & PARAMETER_NAME ) \
134 /*===========================================================================*/
137 /******************************************************************************
138 BIMAP RELATION ACCESS INTERFACE
139 *******************************************************************************
141 template< class Tag, class SymmetricType >
142 typename result_of::NAME<Tag,SymmetricType>::type
143 NAME( const SymmetricType & );
145 ******************************************************************************/
147 /*===========================================================================*/
148 #define BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER( \
153 template< class Tag, class SymmetricType > \
154 BOOST_DEDUCED_TYPENAME result_of::NAME<Tag,SymmetricType>::type \
155 NAME( SymmetricType & s ) \
157 typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: \
162 >::type member_at_tag; \
164 return detail::NAME(member_at_tag(),s); \
166 /*===========================================================================*/
169 #endif // BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP