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/to_mutable_relation_functor.hpp
10 /// \brief functors to convert types to mutable relations
12 #ifndef BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
13 #define BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
15 #if defined(_MSC_VER) && (_MSC_VER>=1200)
19 #include <boost/config.hpp>
21 #include <boost/bimap/relation/support/pair_type_by.hpp>
22 #include <boost/bimap/relation/detail/mutant.hpp>
23 #include <boost/bimap/relation/mutant_relation.hpp>
30 /// \brief Functor used in map views
32 template< class Tag, class Relation >
33 struct pair_to_relation_functor
36 operator()(const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
37 pair_type_by<Tag,Relation>::type & p) const
43 template< class Tag, class TA, class TB, class Info >
44 struct pair_to_relation_functor<
45 Tag,::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
47 typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
50 operator()( BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
51 pair_type_by<Tag,Relation>::type & p ) const
53 return ::boost::bimaps::relation::detail::mutate<Relation>(p);
57 operator()( const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
58 pair_type_by<Tag,Relation>::type & p) const
60 return ::boost::bimaps::relation::detail::mutate<Relation>(p);
65 /// \brief Used in set views
67 template< class Relation >
68 struct get_mutable_relation_functor
71 operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
77 template< class TA, class TB, class Info >
78 struct get_mutable_relation_functor< ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
80 typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
83 operator()( BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
85 return ::boost::bimaps::relation::detail::mutate<Relation>(r);
89 operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
91 return ::boost::bimaps::relation::detail::mutate<Relation>(r);
96 } // namespace relation
101 #endif // BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP