]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_AUX_SYMBOL_HPP_ | |
9 | #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_HPP_ | |
10 | ||
11 | #include <boost/preprocessor/cat.hpp> | |
12 | #include <boost/preprocessor/seq/cat.hpp> | |
13 | #include <boost/preprocessor/seq/transform.hpp> | |
14 | ||
15 | // PRIVATE // | |
16 | ||
17 | // NOTE: INFIX is used to separate symbols concatenated together. Some of these | |
18 | // symbols are user-defined so they can be anything. Because they can contain | |
19 | // underscore `_` and/or start with capital letters, it is NOT safe for the | |
20 | // INFIX to be the underscore `_` character because that could lead to library | |
21 | // defined symbols containing double underscores `__` or a leading underscore | |
22 | // (followed or not by a capital letter) in the global namespace. All these | |
23 | // symbols are reserved by the C++ standard: (1) "each name that contains a | |
24 | // double underscore (_ _) or begins with an underscore followed by an | |
25 | // uppercase letter is reserved to the implementation" and (2) "each name that | |
26 | // begins with an underscore is reserved to the implementation for use as a | |
27 | // name in the global namespace". | |
28 | #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_INFIX_ X // `X` used as separator. | |
29 | ||
30 | #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_PREFIX_ boost_local_function_aux | |
31 | ||
32 | #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_POSTFIX_(s, unused, tokens) \ | |
33 | BOOST_PP_CAT(tokens, BOOST_LOCAL_FUNCTION_AUX_SYMBOL_INFIX_) | |
34 | ||
35 | // PUBLIC // | |
36 | ||
37 | // Prefixes this library reserved symbol. | |
38 | #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL(seq) \ | |
39 | BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TRANSFORM( \ | |
40 | BOOST_LOCAL_FUNCTION_AUX_SYMBOL_POSTFIX_, \ | |
41 | ~, (BOOST_LOCAL_FUNCTION_AUX_SYMBOL_PREFIX_) seq )) | |
42 | ||
43 | // Postfixes this library reserved symbol. | |
44 | #define BOOST_LOCAL_FUNCTION_AUX_SYMBOL_POSTFIX(seq) \ | |
45 | BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TRANSFORM( \ | |
46 | BOOST_LOCAL_FUNCTION_AUX_SYMBOL_POSTFIX_, \ | |
47 | ~, seq (BOOST_LOCAL_FUNCTION_AUX_SYMBOL_PREFIX_) )) | |
48 | ||
49 | #endif // #include guard | |
50 |