mirror of
https://github.com/boostorg/contract.git
synced 2026-02-28 05:12:20 +00:00
parsing template parameters
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_PAREN_EAT_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_EAT_HPP_
|
||||
|
||||
// PRIVATE //
|
||||
|
||||
// IMPLEMENTATION: Must expand to nothing (so to "eat" the first paren).
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_EAT_(...)
|
||||
|
||||
// PUBLIC //
|
||||
|
||||
// Precondition: tokens == `(...[, ...]*) ...[, ...]*`.
|
||||
// Expand to trailing ...[, ...]* above, "eating" parenthesized tokens in front.
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_EAT(tokens) \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_EAT_ tokens
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_PAREN_FIRST_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_FIRST_HPP_
|
||||
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
||||
// PRIVATE //
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_FIRST_SPLIT_(...) (__VA_ARGS__) ,
|
||||
|
||||
// PUBLIC //
|
||||
|
||||
// Precondition: tokens == `(...[, ...]*) ...[, ...]*`.
|
||||
// Expand to `(...[, ...]*)` in front above (discarding any trailing tokens).
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_FIRST(tokens) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, \
|
||||
( BOOST_CONTRACT_EXT_PP_PAREN_FIRST_SPLIT_ tokens ))
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
25
include/boost/contract/ext_/preprocessor/paren/front.hpp
Normal file
25
include/boost/contract/ext_/preprocessor/paren/front.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_PAREN_FRONT_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_FRONT_HPP_
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_FRONT_SPLIT_(...) (__VA_ARGS__) ,
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_FRONT_PAIR_FIRST_(first, second) first
|
||||
|
||||
// NOTE: Using `BOOST_PP_TUPLE_ELEM(2, 0, pair)` confuses MSVC here.
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_FRONT_OO_(pair) \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT_PAIR_FIRST_ pair
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
// Precondition: tokens == `(...[, ...]*) ...[, ...]*`.
|
||||
// Expand to `(...[, ...]*)` in front above (discarding any trailing tokens).
|
||||
// NOTE: To get the trailing `...[, ...]*` use `BOOST_PP_TUPLE_EAT(0) tokens`.
|
||||
#define BOOST_CONTRACT_EXT_PP_PAREN_FRONT(tokens) \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT_OO_(( \
|
||||
BOOST_CONTRACT_EXT_PP_PAREN_FRONT_SPLIT_ tokens))
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
Reference in New Issue
Block a user