]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/bimap/relation/detail/to_mutable_relation_functor.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / bimap / relation / detail / to_mutable_relation_functor.hpp
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/detail/to_mutable_relation_functor.hpp
10 /// \brief functors to convert types to mutable relations
11
12 #ifndef BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
13 #define BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
14
15 #if defined(_MSC_VER)
16 #pragma once
17 #endif
18
19 #include <boost/config.hpp>
20
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>
24
25 namespace boost {
26 namespace bimaps {
27 namespace relation {
28 namespace detail {
29
30 /// \brief Functor used in map views
31
32 template< class Tag, class Relation >
33 struct pair_to_relation_functor
34 {
35 const Relation
36 operator()(const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
37 pair_type_by<Tag,Relation>::type & p) const
38 {
39 return Relation(p);
40 }
41 };
42
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> >
46 {
47 typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
48
49 Relation &
50 operator()( BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
51 pair_type_by<Tag,Relation>::type & p ) const
52 {
53 return ::boost::bimaps::relation::detail::mutate<Relation>(p);
54 }
55
56 const Relation &
57 operator()( const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
58 pair_type_by<Tag,Relation>::type & p) const
59 {
60 return ::boost::bimaps::relation::detail::mutate<Relation>(p);
61 }
62 };
63
64
65 /// \brief Used in set views
66
67 template< class Relation >
68 struct get_mutable_relation_functor
69 {
70 const Relation
71 operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
72 {
73 return Relation(r);
74 }
75 };
76
77 template< class TA, class TB, class Info >
78 struct get_mutable_relation_functor< ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
79 {
80 typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
81
82 Relation &
83 operator()( BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
84 {
85 return ::boost::bimaps::relation::detail::mutate<Relation>(r);
86 }
87
88 const Relation &
89 operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
90 {
91 return ::boost::bimaps::relation::detail::mutate<Relation>(r);
92 }
93 };
94
95 } // namespace detail
96 } // namespace relation
97 } // namespace bimaps
98 } // namespace boost
99
100
101 #endif // BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
102