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 #ifndef BOOST_BIMAP_DETAIL_CHECK_METADATA_HPP
|
Chris@16
|
10 #define BOOST_BIMAP_DETAIL_CHECK_METADATA_HPP
|
Chris@16
|
11
|
Chris@101
|
12 #if defined(_MSC_VER)
|
Chris@16
|
13 #pragma once
|
Chris@16
|
14 #endif
|
Chris@16
|
15
|
Chris@16
|
16 #include <boost/config.hpp>
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/mpl/assert.hpp>
|
Chris@16
|
19 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
20 #include <boost/preprocessor/cat.hpp>
|
Chris@16
|
21
|
Chris@16
|
22
|
Chris@16
|
23 // Easier way to call BOOST_MPL_ASSERT_MSG in class scope
|
Chris@16
|
24 /*===========================================================================*/
|
Chris@16
|
25 #define BOOST_BIMAP_MPL_ASSERT_MSG_ACS(p1,p2,p3) \
|
Chris@16
|
26 \
|
Chris@16
|
27 struct p2 {}; \
|
Chris@16
|
28 BOOST_MPL_ASSERT_MSG(p1,p2,p3); \
|
Chris@16
|
29 /*===========================================================================*/
|
Chris@16
|
30
|
Chris@16
|
31
|
Chris@16
|
32 // Build a descriptive name.
|
Chris@16
|
33 /*===========================================================================*/
|
Chris@16
|
34 #define BOOST_BIMAP_WRONG_METADATA_MESSAGE( \
|
Chris@16
|
35 \
|
Chris@16
|
36 P_CLASS, \
|
Chris@16
|
37 P_NAME, \
|
Chris@16
|
38 P_CORRECT_TYPE \
|
Chris@16
|
39 \
|
Chris@16
|
40 ) \
|
Chris@16
|
41 \
|
Chris@16
|
42 BOOST_PP_CAT \
|
Chris@16
|
43 ( \
|
Chris@16
|
44 WRONG_METADATA__, \
|
Chris@16
|
45 BOOST_PP_CAT \
|
Chris@16
|
46 ( \
|
Chris@16
|
47 P_CLASS, \
|
Chris@16
|
48 BOOST_PP_CAT \
|
Chris@16
|
49 ( \
|
Chris@16
|
50 __AT__, \
|
Chris@16
|
51 BOOST_PP_CAT \
|
Chris@16
|
52 ( \
|
Chris@16
|
53 P_NAME, \
|
Chris@16
|
54 BOOST_PP_CAT \
|
Chris@16
|
55 ( \
|
Chris@16
|
56 __IS_DIFERENT_TO__, \
|
Chris@16
|
57 P_CORRECT_TYPE \
|
Chris@16
|
58 ) \
|
Chris@16
|
59 ) \
|
Chris@16
|
60 ) \
|
Chris@16
|
61 ) \
|
Chris@16
|
62 )
|
Chris@16
|
63 /*===========================================================================*/
|
Chris@16
|
64
|
Chris@16
|
65
|
Chris@16
|
66 // Check if the metadata have the correct type, and if not inform
|
Chris@16
|
67 // it with a useful compile time message.
|
Chris@16
|
68 /*===========================================================================*/
|
Chris@16
|
69 #define BOOST_BIMAP_CHECK_METADATA( \
|
Chris@16
|
70 \
|
Chris@16
|
71 P_CLASS, \
|
Chris@16
|
72 P_NAME, \
|
Chris@16
|
73 P_CORRECT_TYPE \
|
Chris@16
|
74 \
|
Chris@16
|
75 ) \
|
Chris@16
|
76 \
|
Chris@16
|
77 BOOST_BIMAP_MPL_ASSERT_MSG_ACS \
|
Chris@16
|
78 ( \
|
Chris@16
|
79 ( \
|
Chris@16
|
80 ::boost::is_same \
|
Chris@16
|
81 < \
|
Chris@16
|
82 P_CLASS::P_NAME, \
|
Chris@16
|
83 P_CORRECT_TYPE \
|
Chris@16
|
84 \
|
Chris@16
|
85 >::value \
|
Chris@16
|
86 ), \
|
Chris@16
|
87 BOOST_BIMAP_WRONG_METADATA_MESSAGE \
|
Chris@16
|
88 ( \
|
Chris@16
|
89 P_CLASS, \
|
Chris@16
|
90 P_NAME, \
|
Chris@16
|
91 P_CORRECT_TYPE \
|
Chris@16
|
92 ), \
|
Chris@16
|
93 (P_CLASS::P_NAME,P_CORRECT_TYPE) \
|
Chris@16
|
94 )
|
Chris@16
|
95 /*===========================================================================*/
|
Chris@16
|
96
|
Chris@16
|
97
|
Chris@16
|
98 // Just for autodocumment the test code
|
Chris@16
|
99 /*===========================================================================*/
|
Chris@16
|
100 #define BOOST_BIMAP_TEST_STATIC_FUNCTION(NAME) \
|
Chris@16
|
101 namespace NAME
|
Chris@16
|
102 /*===========================================================================*/
|
Chris@16
|
103
|
Chris@16
|
104
|
Chris@16
|
105 // Just for autodocument the test code
|
Chris@16
|
106 /*===========================================================================*/
|
Chris@16
|
107 #define BOOST_BIMAP_CALL_TEST_STATIC_FUNCTION(NAME)
|
Chris@16
|
108 /*===========================================================================*/
|
Chris@16
|
109
|
Chris@16
|
110
|
Chris@16
|
111
|
Chris@16
|
112 #endif // BOOST_BIMAP_DETAIL_CHECK_METADATA_HPP
|
Chris@16
|
113
|