Chris@16
|
1 // Boost.Bimap
|
Chris@16
|
2 //
|
Chris@16
|
3 // Copyright (c) 2006-2007 Matias Capeletto
|
Chris@16
|
4 //
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
6 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 /// \file support/map_by.hpp
|
Chris@16
|
10 /// \brief map_by<tag>(b) function
|
Chris@16
|
11
|
Chris@16
|
12 #ifndef BOOST_BIMAP_SUPPORT_MAP_BY_HPP
|
Chris@16
|
13 #define BOOST_BIMAP_SUPPORT_MAP_BY_HPP
|
Chris@16
|
14
|
Chris@101
|
15 #if defined(_MSC_VER)
|
Chris@16
|
16 #pragma once
|
Chris@16
|
17 #endif
|
Chris@16
|
18
|
Chris@16
|
19 #include <boost/config.hpp>
|
Chris@16
|
20
|
Chris@16
|
21 #include <boost/bimap/support/map_type_by.hpp>
|
Chris@16
|
22 #include <boost/bimap/relation/detail/access_builder.hpp>
|
Chris@16
|
23
|
Chris@16
|
24
|
Chris@16
|
25 #ifdef BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
|
Chris@16
|
26
|
Chris@16
|
27 namespace boost {
|
Chris@16
|
28 namespace bimaps {
|
Chris@16
|
29 namespace support {
|
Chris@16
|
30
|
Chris@16
|
31 /** \brief Gets a map view of a bidirectional map
|
Chris@16
|
32
|
Chris@16
|
33 Convertible to \c map_type_by<Tag,Bimap>::type
|
Chris@16
|
34 Instead of using \c map_type_by<Tag,Bimap>::type this functions use
|
Chris@16
|
35 \b Boost.call_traits to find the best way to return this value. To help
|
Chris@16
|
36 the user of this function the following metafunction is provided
|
Chris@16
|
37 \code
|
Chris@16
|
38
|
Chris@16
|
39 namespace result_of {
|
Chris@16
|
40
|
Chris@16
|
41 template< class Tag, class Bimap >
|
Chris@16
|
42 struct map_by( Bimap & b );
|
Chris@16
|
43
|
Chris@16
|
44 } // namespace result_of
|
Chris@16
|
45
|
Chris@16
|
46 \endcode
|
Chris@16
|
47
|
Chris@16
|
48 See also member_at, value_type_of.
|
Chris@16
|
49 \ingroup bimap_group
|
Chris@16
|
50 **/
|
Chris@16
|
51
|
Chris@16
|
52 template< class Tag, class Bimap >
|
Chris@16
|
53 BOOST_DEDUCED_TYPENAME result_of::map_by<Tag,Bimap>::type
|
Chris@16
|
54 map_by( Bimap & b );
|
Chris@16
|
55
|
Chris@16
|
56 } // namespace support
|
Chris@16
|
57 } // namespace bimaps
|
Chris@16
|
58 } // namespace boost
|
Chris@16
|
59
|
Chris@16
|
60 #endif // BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
|
Chris@16
|
61
|
Chris@16
|
62
|
Chris@16
|
63
|
Chris@16
|
64 #ifndef BOOST_BIMAP_DOXIGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
|
Chris@16
|
65
|
Chris@16
|
66 namespace boost {
|
Chris@16
|
67 namespace bimaps {
|
Chris@16
|
68 namespace support {
|
Chris@16
|
69
|
Chris@16
|
70 // Since it is very error-prone to directly write the hole bunch
|
Chris@16
|
71 // of relation accesor. They are buil from litle macro blocks that
|
Chris@16
|
72 // are both more readable, leading to self docummenting code and a
|
Chris@16
|
73 // lot more easier to understand and mantain.
|
Chris@16
|
74 // It is very important to note that the three building blocks have
|
Chris@16
|
75 // to laid in the same namespace in order to work. There is also
|
Chris@16
|
76 // important to keep them in order.
|
Chris@16
|
77 // The forward declaration are not necesary but they help a lot to
|
Chris@16
|
78 // the reader, as they undercover what is the signature of the
|
Chris@16
|
79 // result code.
|
Chris@16
|
80 // In the end, it is not quicker to do it in this way because you
|
Chris@16
|
81 // write a lot. But this code has no complexity at all and almost
|
Chris@16
|
82 // every word writed is for documentation.
|
Chris@16
|
83
|
Chris@16
|
84 // Result of
|
Chris@16
|
85 // -------------------------------------------------------------------------
|
Chris@16
|
86 /*
|
Chris@16
|
87 namespace result_of {
|
Chris@16
|
88
|
Chris@16
|
89 template< class Tag, class Bimap >
|
Chris@16
|
90 struct map_by<Tag,Bimap>;
|
Chris@16
|
91 {
|
Chris@16
|
92 typedef -unspecified- type;
|
Chris@16
|
93 };
|
Chris@16
|
94
|
Chris@16
|
95 } // namespace result_of
|
Chris@16
|
96
|
Chris@16
|
97 */
|
Chris@16
|
98
|
Chris@16
|
99 BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER
|
Chris@16
|
100 (
|
Chris@16
|
101 map_by,
|
Chris@16
|
102 map_type_by
|
Chris@16
|
103 )
|
Chris@16
|
104
|
Chris@16
|
105 // Implementation
|
Chris@16
|
106 // -------------------------------------------------------------------------
|
Chris@16
|
107
|
Chris@16
|
108 BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER
|
Chris@16
|
109 (
|
Chris@16
|
110 map_by,
|
Chris@16
|
111 Bimap,
|
Chris@16
|
112 b,
|
Chris@16
|
113 return b.left,
|
Chris@16
|
114 return b.right
|
Chris@16
|
115 )
|
Chris@16
|
116
|
Chris@16
|
117 // Interface
|
Chris@16
|
118 // --------------------------------------------------------------------------
|
Chris@16
|
119
|
Chris@16
|
120 BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER
|
Chris@16
|
121 (
|
Chris@16
|
122 map_by
|
Chris@16
|
123 )
|
Chris@16
|
124
|
Chris@16
|
125 } // namespace support
|
Chris@16
|
126 } // namespace bimaps
|
Chris@16
|
127 } // namespace boost
|
Chris@16
|
128
|
Chris@16
|
129 #endif // BOOST_BIMAP_DOXIGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
|
Chris@16
|
130
|
Chris@16
|
131 #endif // BOOST_BIMAP_SUPPORT_MAP_BY_HPP
|
Chris@16
|
132
|