Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:38

0001 // Boost.Bimap
0002 //
0003 // Copyright (c) 2006-2007 Matias Capeletto
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 // (See accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 /// \file relation/detail/to_mutable_relation_functor.hpp
0010 /// \brief functors to convert types to mutable relations
0011 
0012 #ifndef BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
0013 #define BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
0014 
0015 #if defined(_MSC_VER)
0016 #pragma once
0017 #endif
0018 
0019 #include <boost/config.hpp>
0020 
0021 #include <boost/bimap/relation/support/pair_type_by.hpp>
0022 #include <boost/bimap/relation/detail/mutant.hpp>
0023 #include <boost/bimap/relation/mutant_relation.hpp>
0024 
0025 namespace boost {
0026 namespace bimaps {
0027 namespace relation {
0028 namespace detail {
0029 
0030 /// \brief Functor used in map views
0031 
0032 template< class Tag, class Relation >
0033 struct pair_to_relation_functor
0034 {
0035     const Relation
0036         operator()(const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
0037                             pair_type_by<Tag,Relation>::type & p) const
0038     {
0039         return Relation(p);
0040     }
0041 };
0042 
0043 template< class Tag, class TA, class TB, class Info >
0044 struct pair_to_relation_functor<
0045     Tag,::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
0046 {
0047     typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
0048 
0049     Relation &
0050         operator()( BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
0051             pair_type_by<Tag,Relation>::type & p ) const
0052     {
0053         return ::boost::bimaps::relation::detail::mutate<Relation>(p);
0054     }
0055 
0056     const Relation &
0057         operator()( const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
0058             pair_type_by<Tag,Relation>::type & p) const
0059     {
0060         return ::boost::bimaps::relation::detail::mutate<Relation>(p);
0061     }
0062 };
0063 
0064 
0065 /// \brief Used in set views
0066 
0067 template< class Relation >
0068 struct get_mutable_relation_functor
0069 {
0070     const Relation
0071     operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
0072     {
0073         return Relation(r);
0074     }
0075 };
0076 
0077 template< class TA, class TB, class Info >
0078 struct get_mutable_relation_functor< ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
0079 {
0080     typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
0081 
0082     Relation &
0083     operator()( BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
0084     {
0085         return ::boost::bimaps::relation::detail::mutate<Relation>(r);
0086     }
0087 
0088     const Relation &
0089     operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
0090     {
0091         return ::boost::bimaps::relation::detail::mutate<Relation>(r);
0092     }
0093 };
0094 
0095 } // namespace detail
0096 } // namespace relation
0097 } // namespace bimaps
0098 } // namespace boost
0099 
0100 
0101 #endif // BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
0102