|
||||
File indexing completed on 2025-01-18 09:50:27
0001 //============================================================================== 0002 // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II 0003 // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI 0004 // Copyright 2011 Eric Niebler 0005 // 0006 // Distributed under the Boost Software License, Version 1.0. 0007 // See accompanying file LICENSE.txt or copy at 0008 // http://www.boost.org/LICENSE_1_0.txt 0009 //============================================================================== 0010 #ifndef BOOST_PROTO_PREPROCESSOR_REMOVE_TYPENAME_HPP_INCLUDED 0011 #define BOOST_PROTO_PREPROCESSOR_REMOVE_TYPENAME_HPP_INCLUDED 0012 0013 /*! 0014 * \file 0015 * \brief Defines the BOOST_PROTO_REMOVE_TYPENAME macro 0016 */ 0017 #include <boost/preprocessor/cat.hpp> 0018 #include <boost/preprocessor/expand.hpp> 0019 #include <boost/preprocessor/tuple/eat.hpp> 0020 #include <boost/preprocessor/control/iif.hpp> 0021 #include <boost/preprocessor/detail/is_unary.hpp> 0022 0023 //============================================================================== 0024 // Boost.Preprocessor author P. Mensodines confirmed on an Boost email thread 0025 // (subject ``check if a token is a keyword (was "BOOST_PP_IS_UNARY()")'') 0026 // that it is OK to used `PP_IS_UNARY()` to check if tokens match predefined 0027 // "keyword" as it is done by the macros below (even if `PP_IS_UNARY()` is 0028 // technically only part of Boost.Preprocessor private API). 0029 //============================================================================== 0030 0031 //============================================================================== 0032 // `checking_prefix ## tokens` expand to unary (e.g., `(1)`) iff `tokens` start 0033 // with keyword to check. 0034 //============================================================================== 0035 #define BOOST_PROTO_DETAILS_KEYWORD_FACILITY_IS_FRONT(T, CHECKING_PREFIX) \ 0036 BOOST_PP_IS_UNARY(BOOST_PP_CAT(CHECKING_PREFIX, T)) \ 0037 /**/ 0038 0039 //============================================================================== 0040 // `is_front_macro(tokens)` is 1 iff `tokens` start with keyword to remove. 0041 // `removing_prefix ## <keyword-to-remove>` must expand to nothing. 0042 //============================================================================== 0043 #define BOOST_PROTO_DETAILS_KEYWORD_FACILITY_REMOVE_FRONT(TOKENS, IS_FRONT_MACRO, REMOVING_PREFIX) \ 0044 BOOST_PP_EXPAND( /* without EXPAND doesn't expand on MSVC */ \ 0045 BOOST_PP_IIF( \ 0046 IS_FRONT_MACRO(TOKENS) \ 0047 , BOOST_PP_CAT \ 0048 , TOKENS BOOST_PP_TUPLE_EAT(2) \ 0049 )(REMOVING_PREFIX, TOKENS) \ 0050 ) \ 0051 /**/ 0052 0053 #define BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS_typename (1) /* unary */ 0054 #define typename_BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS (1) /* unary */ 0055 #define BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE_typename /* nothing */ 0056 #define typename_BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE /* nothing */ 0057 0058 #define BOOST_PROTO_DETAILS_KEYWORD_IS_TYPENAME_FRONT(TOKENS) \ 0059 BOOST_PROTO_DETAILS_KEYWORD_FACILITY_IS_FRONT(TOKENS, BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS_) \ 0060 /**/ 0061 0062 //============================================================================== 0063 /*! 0064 * \ingroup preprocessor 0065 * For any symbol \c X, this macro returns the same symbol from which a potential 0066 * leading \c typename keyword has been removed. If no typename keyword is present, 0067 * this macros evaluates to \c X itself without error. 0068 * 0069 * The original implementation of this macro is from Lorenzo Caminiti. 0070 * 0071 * \param X Symbol to remove \c typename from 0072 */ 0073 //============================================================================== 0074 #define BOOST_PROTO_REMOVE_TYPENAME(X) \ 0075 BOOST_PROTO_DETAILS_KEYWORD_FACILITY_REMOVE_FRONT( \ 0076 X \ 0077 , BOOST_PROTO_DETAILS_KEYWORD_IS_TYPENAME_FRONT \ 0078 , BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE_ \ 0079 ) \ 0080 /**/ 0081 0082 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |