1 | |
---|
2 | #ifndef BOOST_MPL_AUX_PREPROCESSOR_TOKEN_EQUAL_HPP_INCLUDED |
---|
3 | #define BOOST_MPL_AUX_PREPROCESSOR_TOKEN_EQUAL_HPP_INCLUDED |
---|
4 | |
---|
5 | // Copyright Paul Mensonides 2003 |
---|
6 | // Copyright Aleksey Gurtovoy 2003-2004 |
---|
7 | // |
---|
8 | // Distributed under the Boost Software License, Version 1.0. |
---|
9 | // (See accompanying file LICENSE_1_0.txt or copy at |
---|
10 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
11 | // |
---|
12 | // See http://www.boost.org/libs/mpl for documentation. |
---|
13 | |
---|
14 | // $Id: token_equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ |
---|
15 | // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ |
---|
16 | // $Revision: 49267 $ |
---|
17 | |
---|
18 | #include <boost/mpl/aux_/preprocessor/is_seq.hpp> |
---|
19 | |
---|
20 | #include <boost/preprocessor/if.hpp> |
---|
21 | #include <boost/preprocessor/logical/bitand.hpp> |
---|
22 | #include <boost/preprocessor/logical/compl.hpp> |
---|
23 | #include <boost/preprocessor/tuple/eat.hpp> |
---|
24 | #include <boost/preprocessor/cat.hpp> |
---|
25 | |
---|
26 | // compares tokens 'a' and 'b' for equality: |
---|
27 | // |
---|
28 | // #define BOOST_MPL_PP_TOKEN_EQUAL_apple(x) x |
---|
29 | // #define BOOST_MPL_PP_TOKEN_EQUAL_orange(x) x |
---|
30 | // |
---|
31 | // BOOST_PP_ASSERT( BOOST_PP_NOT( BOOST_MPL_PP_TOKEN_EQUAL(apple, abc) ) ) |
---|
32 | // BOOST_PP_ASSERT( BOOST_PP_NOT( BOOST_MPL_PP_TOKEN_EQUAL(abc, apple) ) ) |
---|
33 | // BOOST_PP_ASSERT( BOOST_PP_NOT( BOOST_MPL_PP_TOKEN_EQUAL(apple, orange) ) ) |
---|
34 | // BOOST_PP_ASSERT( BOOST_MPL_PP_TOKEN_EQUAL(apple, apple) ) |
---|
35 | // BOOST_PP_ASSERT( BOOST_MPL_PP_TOKEN_EQUAL(orange, orange) ) |
---|
36 | |
---|
37 | #define BOOST_MPL_PP_TOKEN_EQUAL(a, b) \ |
---|
38 | BOOST_PP_IIF( \ |
---|
39 | BOOST_PP_BITAND( \ |
---|
40 | BOOST_MPL_PP_IS_SEQ( BOOST_PP_CAT(BOOST_MPL_PP_TOKEN_EQUAL_, a)((unused)) ) \ |
---|
41 | , BOOST_MPL_PP_IS_SEQ( BOOST_PP_CAT(BOOST_MPL_PP_TOKEN_EQUAL_, b)((unused)) ) \ |
---|
42 | ) \ |
---|
43 | , BOOST_MPL_PP_TOKEN_EQUAL_I \ |
---|
44 | , 0 BOOST_PP_TUPLE_EAT(2) \ |
---|
45 | )(a, b) \ |
---|
46 | /**/ |
---|
47 | |
---|
48 | #define BOOST_MPL_PP_TOKEN_EQUAL_I(a, b) \ |
---|
49 | BOOST_PP_COMPL(BOOST_MPL_PP_IS_SEQ( \ |
---|
50 | BOOST_MPL_PP_TOKEN_EQUAL_ ## a( \ |
---|
51 | BOOST_MPL_PP_TOKEN_EQUAL_ ## b \ |
---|
52 | )((unused)) \ |
---|
53 | )) \ |
---|
54 | /**/ |
---|
55 | |
---|
56 | #endif // BOOST_MPL_AUX_PREPROCESSOR_TOKEN_EQUAL_HPP_INCLUDED |
---|