Chris@16
|
1
|
Chris@16
|
2 // Copyright (C) 2009-2012 Lorenzo Caminiti
|
Chris@16
|
3 // Distributed under the Boost Software License, Version 1.0
|
Chris@16
|
4 // (see accompanying file LICENSE_1_0.txt or a copy at
|
Chris@16
|
5 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 // Home at http://www.boost.org/libs/local_function
|
Chris@16
|
7
|
Chris@16
|
8 #ifndef BOOST_LOCAL_FUNCTION_AUX_SYMBOL_HPP_
|
Chris@16
|
9 #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_HPP_
|
Chris@16
|
10
|
Chris@16
|
11 #include <boost/preprocessor/cat.hpp>
|
Chris@16
|
12 #include <boost/preprocessor/seq/cat.hpp>
|
Chris@16
|
13 #include <boost/preprocessor/seq/transform.hpp>
|
Chris@16
|
14
|
Chris@16
|
15 // PRIVATE //
|
Chris@16
|
16
|
Chris@16
|
17 // NOTE: INFIX is used to separate symbols concatenated together. Some of these
|
Chris@16
|
18 // symbols are user-defined so they can be anything. Because they can contain
|
Chris@16
|
19 // underscore `_` and/or start with capital letters, it is NOT safe for the
|
Chris@16
|
20 // INFIX to be the underscore `_` character because that could lead to library
|
Chris@16
|
21 // defined symbols containing double underscores `__` or a leading underscore
|
Chris@16
|
22 // (followed or not by a capital letter) in the global namespace. All these
|
Chris@16
|
23 // symbols are reserved by the C++ standard: (1) "each name that contains a
|
Chris@16
|
24 // double underscore (_ _) or begins with an underscore followed by an
|
Chris@16
|
25 // uppercase letter is reserved to the implementation" and (2) "each name that
|
Chris@16
|
26 // begins with an underscore is reserved to the implementation for use as a
|
Chris@16
|
27 // name in the global namespace".
|
Chris@16
|
28 #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_INFIX_ X // `X` used as separator.
|
Chris@16
|
29
|
Chris@16
|
30 #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_PREFIX_ boost_local_function_aux
|
Chris@16
|
31
|
Chris@16
|
32 #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_POSTFIX_(s, unused, tokens) \
|
Chris@16
|
33 BOOST_PP_CAT(tokens, BOOST_LOCAL_FUNCTION_AUX_SYMBOL_INFIX_)
|
Chris@16
|
34
|
Chris@16
|
35 // PUBLIC //
|
Chris@16
|
36
|
Chris@16
|
37 // Prefixes this library reserved symbol.
|
Chris@16
|
38 #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL(seq) \
|
Chris@16
|
39 BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TRANSFORM( \
|
Chris@16
|
40 BOOST_LOCAL_FUNCTION_AUX_SYMBOL_POSTFIX_, \
|
Chris@16
|
41 ~, (BOOST_LOCAL_FUNCTION_AUX_SYMBOL_PREFIX_) seq ))
|
Chris@16
|
42
|
Chris@16
|
43 // Postfixes this library reserved symbol.
|
Chris@16
|
44 #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_POSTFIX(seq) \
|
Chris@16
|
45 BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TRANSFORM( \
|
Chris@16
|
46 BOOST_LOCAL_FUNCTION_AUX_SYMBOL_POSTFIX_, \
|
Chris@16
|
47 ~, seq (BOOST_LOCAL_FUNCTION_AUX_SYMBOL_PREFIX_) ))
|
Chris@16
|
48
|
Chris@16
|
49 #endif // #include guard
|
Chris@16
|
50
|