]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/bimap/relation/support/get.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / bimap / relation / support / get.hpp
CommitLineData
7c673cae
FG
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/support/get.hpp
10/// \brief get<tag>(r) function
11
12#ifndef BOOST_BIMAP_RELATION_SUPPORT_GET_HPP
13#define BOOST_BIMAP_RELATION_SUPPORT_GET_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/value_type_of.hpp>
22
23#include <boost/bimap/relation/detail/access_builder.hpp>
24
25#include <boost/mpl/if.hpp>
26#include <boost/type_traits/is_same.hpp>
27#include <boost/type_traits/is_const.hpp>
28
29#ifdef BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
30
31
32namespace boost {
33namespace bimaps {
34namespace relation {
35namespace support {
36
37/** \brief Gets a pair view of the relation.
38
39\ingroup relation_group
40 **/
41
42template< class Tag, class SymmetricType >
43BOOST_DEDUCED_TYPENAME result_of::get<Tag,SymmetricType>::type
44 get( SymmetricType & );
45
46} // namespace support
47} // namespace relation
48} // namespace bimaps
49} // namespace boost
50
51#endif // BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
52
53
54
55#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
56
57namespace boost {
58namespace bimaps {
59namespace relation {
60namespace support {
61
62// Since it is very error-prone to directly write the hole bunch
20effc67 63// of relation accesor. They are built from little macro blocks that
7c673cae 64// are both more readable, leading to self docummenting code and a
20effc67 65// lot more easier to understand and maintain.
7c673cae
FG
66// It is very important to note that the three building blocks have
67// to laid in the same namespace in order to work. There is also
68// important to keep them in order.
20effc67 69// The forward declaration are not necessary but they help a lot to
7c673cae
FG
70// the reader, as they undercover what is the signature of the
71// result code.
72// In the end, it is not quicker to do it in this way because you
73// write a lot. But this code has no complexity at all and almost
74// every word writed is for documentation.
75
76// Result of
77// -------------------------------------------------------------------------
78/*
79 namespace result_of {
80
81 template< class Tag, class Relation >
82 struct get<Tag,Relation>;
83 {
84 typedef -unspecified- type;
85 };
86
87 } // namespace result_of
88
89*/
90
91BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER
92(
93 get,
94 value_type_of
95)
96
97
98
99// Implementation
100// -------------------------------------------------------------------------
101
102BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER
103(
104 get,
105 SymmetricType,
106 st,
107 return st.get_left(),
108 return st.get_right()
109)
110
111namespace detail {
112
113template< class SymmetricType >
114BOOST_DEDUCED_TYPENAME result_of::get<
115 ::boost::bimaps::relation::member_at::info, SymmetricType >::type
116get(::boost::bimaps::relation::member_at::info, SymmetricType & rel)
117{
118 return rel.info;
119}
120
121} // namespace detail
122
123// Interface
124//----------------------------------------------------------------------------
125
126BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER
127(
128 get
129)
130
131
132} // namespace support
133} // namespace relation
134} // namespace bimaps
135} // namespace boost
136
137#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
138
139#endif // BOOST_BIMAP_RELATION_SUPPORT_GET_HPP
140