]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/local_function/include/boost/local_function/detail/preprocessor/keyword/facility/is.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / local_function / include / boost / local_function / detail / preprocessor / keyword / facility / is.hpp
1
2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/local_function
7
8 #ifndef BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_HPP_
9 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_HPP_
10
11 // Boost.Preprocessor author P. Mensodines confirmed on an Boost email thread
12 // (subject ``check if a token is a keyword (was "BOOST_PP_IS_UNARY()")'')
13 // that it is OK to used `PP_IS_UNARY()` to check if tokens match predefined
14 // "keyword" as it is done by the macros below (even if `PP_IS_UNARY()` is
15 // technically only part of Boost.Preprocessor private API).
16 #include <boost/preprocessor/detail/is_unary.hpp>
17 #include <boost/preprocessor/cat.hpp>
18 #include <boost/preprocessor/control/iif.hpp>
19 #include <boost/preprocessor/tuple/eat.hpp>
20
21 // PRIVATE //
22
23 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_(a, b) \
24 BOOST_PP_IS_UNARY(BOOST_PP_CAT(a, b))
25
26 // PUBLIC //
27
28 // `checking_prefix ## tokens` expand to unary (e.g., `(1)`) iff `tokens` start
29 // with keyword to check.
30 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT( \
31 tokens, checking_prefix) \
32 BOOST_PP_IIF(BOOST_PP_IS_UNARY(tokens), \
33 /* on MSVC this check works even if tokens already unary but on */ \
34 /* C++03 (including GCC) this check on non-unary tokens gives */ \
35 /* a concatenation error -- so return false is tokens is not unary */ \
36 0 BOOST_PP_TUPLE_EAT(2) \
37 , \
38 BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_ \
39 )(checking_prefix, tokens)
40
41 // `token ## checking_postfix` expand to unary (e.g., `(1)`) iff `token` is the
42 // keyword to check. This check only works if `token` is a single token, it
43 // will always expand to 0 if token is multiple tokens (e.g., `const *this`).
44 // This check will expand to 0 with no error if `token` starts with a
45 // non-alphanumeric symbol (e.g., `*this`).
46 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_BACK( \
47 token, checking_postfix) \
48 BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_IS_(token, checking_postfix)
49
50 #endif // #include guard
51