• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/pair_by.hpp
10 /// \brief pair_by<member>(r) function
11 
12 #ifndef BOOST_BIMAP_RELATION_SUPPORT_PAIR_BY_HPP
13 #define BOOST_BIMAP_RELATION_SUPPORT_PAIR_BY_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/access_builder.hpp>
23 
24 #ifdef BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
25 
26 namespace boost {
27 namespace bimaps {
28 namespace relation {
29 namespace support {
30 
31 /** \brief Gets a pair view of the relation.
32 
33 \ingroup relation_group
34                                                                         **/
35 
36 template< class Tag, class Relation >
37 BOOST_DEDUCED_TYPENAME result_of::pair_by<Tag,Relation>::type
38     pair_by( Relation & rel );
39 
40 } // namespace support
41 } // namespace relation
42 } // namespace bimaps
43 } // namespace boost
44 
45 #endif // BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
46 
47 
48 #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
49 
50 namespace boost {
51 namespace bimaps {
52 namespace relation {
53 namespace support {
54 
55 
56 // Since it is very error-prone to directly write the hole bunch
57 // of relation accesor. They are built from little macro blocks that
58 // are both more readable, leading to self docummenting code and a
59 // lot more easier to understand and maintain.
60 // It is very important to note that the three building blocks have
61 // to laid in the same namespace in order to work. There is also
62 // important to keep them in order.
63 // The forward declaration are not necessary but they help a lot to
64 // the reader, as they undercover what is the signature of the
65 // result code.
66 // In the end, it is not quicker to do it in this way because you
67 // write a lot. But this code has no complexity at all and almost
68 // every word writed is for documentation.
69 
70 // Result of
71 // -------------------------------------------------------------------------
72 /*
73     namespace result_of {
74 
75     template< class Tag, class Relation >
76     struct pair_by<Tag,Relation>;
77     {
78         typedef -unspecified- type;
79     };
80 
81     } // namespace result_of
82 */
83 
84 BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER
85 (
86     pair_by,
87     pair_type_by
88 )
89 
90 
91 
92 // Implementation
93 // -------------------------------------------------------------------------
94 
95 BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER
96 (
97     pair_by,
98     Relation,
99     rel,
100     return rel.get_left_pair(),
101     return rel.get_right_pair()
102 )
103 
104 // Interface
105 // --------------------------------------------------------------------------
106 
107 BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER
108 (
109     pair_by
110 )
111 
112 } // namespace support
113 } // namespace relation
114 } // namespace bimaps
115 } // namespace boost
116 
117 
118 #endif // BOOST_BIMAP_DOXIGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
119 
120 #endif // BOOST_BIMAP_RELATION_SUPPORT_PAIR_BY_HPP
121