4ef6cae93806b386b062f4e26478214845208d07
[senf.git] / boost / bimap / relation / detail / metadata_access_builder.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/metadata_access_builder.hpp
10 /// \brief Define macros to help building metafunctions
11
12 #ifndef BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCESS_BUILDER_HPP
13 #define BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCESS_BUILDER_HPP
14
15 #if defined(_MSC_VER) && (_MSC_VER>=1200)
16 #pragma once
17 #endif
18
19 #include <boost/config.hpp>
20
21 #include <boost/bimap/relation/support/is_tag_of_member_at.hpp>
22 #include <boost/bimap/detail/debug/static_error.hpp>
23 #include <boost/utility/enable_if.hpp>
24 #include <boost/preprocessor/cat.hpp>
25
26
27
28 /******************************************************************************
29               BIMAP SYMMETRIC METADATA ACCESS INTERFACE
30 *******************************************************************************
31
32 template< class Tag, class SymmetricType >
33 struct NAME
34 {
35     typedef -unspecified- type;
36 };
37
38 ******************************************************************************/
39
40
41 /*===========================================================================*/
42 #define BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER(                        \
43                                                                               \
44         NAME,                                                                 \
45         METADATA_BY_LEFT,                                                     \
46         METADATA_BY_RIGHT                                                     \
47     )                                                                         \
48                                                                               \
49     template                                                                  \
50     <                                                                         \
51         class Tag,                                                            \
52         class SymmetricType,                                                  \
53         class Enable = void                                                   \
54     >                                                                         \
55     struct NAME                                                               \
56     {                                                                         \
57         BOOST_BIMAP_STATIC_ERROR(                                             \
58             BOOST_PP_CAT(NAME,_FAILURE),                                      \
59             (SymmetricType,Tag)                                               \
60         );                                                                    \
61     };                                                                        \
62                                                                               \
63     template< class Tag, class SymmetricType >                                \
64     struct NAME                                                               \
65     <                                                                         \
66         Tag, SymmetricType,                                                   \
67         BOOST_DEDUCED_TYPENAME enable_if                                      \
68         <                                                                     \
69             ::boost::bimaps::relation::support::is_tag_of_member_at_left      \
70             <                                                                 \
71                 Tag,                                                          \
72                 SymmetricType                                                 \
73             >                                                                 \
74                                                                               \
75         >::type                                                               \
76     >                                                                         \
77     {                                                                         \
78         typedef BOOST_DEDUCED_TYPENAME SymmetricType::METADATA_BY_LEFT type;  \
79     };                                                                        \
80                                                                               \
81     template< class Tag, class SymmetricType >                                \
82     struct NAME                                                               \
83     <                                                                         \
84         Tag, SymmetricType,                                                   \
85         BOOST_DEDUCED_TYPENAME enable_if                                      \
86         <                                                                     \
87             ::boost::bimaps::relation::support::is_tag_of_member_at_right     \
88             <                                                                 \
89                 Tag,                                                          \
90                 SymmetricType                                                 \
91             >                                                                 \
92                                                                               \
93         >::type                                                               \
94     >                                                                         \
95     {                                                                         \
96         typedef BOOST_DEDUCED_TYPENAME SymmetricType::METADATA_BY_RIGHT type; \
97     };
98 /*===========================================================================*/
99
100
101 #endif // BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCES_BUILDER_HPP
102
103