tested most template type and value parameters

This commit is contained in:
Lorenzo Caminiti
2014-12-16 19:03:48 -08:00
parent 4dfe5a4b92
commit 00f9b4100e
5 changed files with 41 additions and 33 deletions

View File

@@ -3,6 +3,7 @@
#define BOOST_CONTRACT_EXT_PP_TRAITS_ADT_HPP_
#include <boost/contract/ext_/preprocessor/utility/nil.hpp>
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/seq/replace.hpp>
@@ -44,11 +45,13 @@
// NOTE: Using `BOOST_PP_TUPLE_ELEM(2, 0, sign_traits)` confuses MSVC here.
#define BOOST_CONTRACT_EXT_PP_SIGN_TRAITS_FIRST(sign_traits) \
BOOST_CONTRACT_EXT_PP_SIGN_TRAITS_FIRST_ sign_traits
BOOST_CONTRACT_EXT_PP_EXPAND1( \
BOOST_CONTRACT_EXT_PP_SIGN_TRAITS_FIRST_ sign_traits)
// NOTE: Using `BOOST_PP_TUPLE_ELEM(2, 1, sign_traits)` confuses MSVC here.
#define BOOST_CONTRACT_EXT_PP_SIGN_TRAITS_SECOND(sign_traits) \
BOOST_CONTRACT_EXT_PP_SIGN_TRAITS_SECOND_ sign_traits
BOOST_CONTRACT_EXT_PP_EXPAND1( \
BOOST_CONTRACT_EXT_PP_SIGN_TRAITS_SECOND_ sign_traits)
#endif // #include guard

View File

@@ -9,6 +9,7 @@
#include <boost/contract/ext_/preprocessor/traits/aux_/keyword_paren.hpp>
#include <boost/contract/ext_/preprocessor/traits/aux_/type.hpp>
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
#include <boost/contract/ext_/preprocessor/utility/expand.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
@@ -43,8 +44,11 @@
#define BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_KIND_PARSE(sign_traits) \
( \
BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_KIND_SIGN_ sign_traits, \
BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_KIND_TRAIT_ sign_traits \
BOOST_CONTRACT_EXT_PP_EXPAND1( \
BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_KIND_SIGN_ sign_traits) \
, \
BOOST_CONTRACT_EXT_PP_EXPAND1( \
BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_KIND_TRAIT_ sign_traits) \
)
// Expand to `typename | class | (,,,) | template( ,,, ) class` (for type,

View File

@@ -0,0 +1,18 @@
#ifndef BOOST_CONTRACT_EXT_PP_EXPAND_HPP_
#define BOOST_CONTRACT_EXT_PP_EXPAND_HPP_
/* PUBLIC */
// Expand its argument once, `BOOST_PP_EXPAND` expands twice instead:
// EXPAND1(x) --> x (x expanded once)
// EXPAND(x) --> EXPAND_(x) --> x (x expanded twice)
// NOTE: This macro is sometimes useful to enforce proper macro expansion on
// MSVC (on better preprocessors like GCC, CLang, and Wave this macro is not
// necessary instead). For example, `EXPAND1(macro args) ...` where `args` is
// `(a, b EMPTY)` expands to `macro(a, b EMPTY) ...`, otherwise MSVc would
// sometimes confuse `...` as arguments for `EMPTY`.
#define BOOST_CONTRACT_EXT_PP_EXPAND1(tokens) tokens
#endif // #include gaurd