mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Use BOOST_PP_VARIADIC_SIZE instead of custom implementation
This commit is contained in:
parent
bb77c1702f
commit
3845d57531
2 changed files with 3 additions and 110 deletions
|
|
@ -18,7 +18,7 @@
|
||||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||||
#include <boost/preprocessor/stringize.hpp>
|
#include <boost/preprocessor/stringize.hpp>
|
||||||
#include <boost/preprocessor/variadic/to_array.hpp>
|
#include <boost/preprocessor/variadic/size.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
|
@ -178,118 +178,11 @@ const constraint<detail::not_<Constraint>> operator!(const constraint<Constraint
|
||||||
#define MOCK_CONSTRAINT_EXT(Name, n, Args, Expr) \
|
#define MOCK_CONSTRAINT_EXT(Name, n, Args, Expr) \
|
||||||
BOOST_PP_IF(n, MOCK_NARY_CONSTRAINT, MOCK_UNARY_CONSTRAINT)(Name, n, Args, Expr)
|
BOOST_PP_IF(n, MOCK_NARY_CONSTRAINT, MOCK_UNARY_CONSTRAINT)(Name, n, Args, Expr)
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
# define MOCK_VARIADIC_SIZE(...) \
|
|
||||||
BOOST_PP_CAT(MOCK_VARIADIC_SIZE_I(__VA_ARGS__, \
|
|
||||||
32, \
|
|
||||||
31, \
|
|
||||||
30, \
|
|
||||||
29, \
|
|
||||||
28, \
|
|
||||||
27, \
|
|
||||||
26, \
|
|
||||||
25, \
|
|
||||||
24, \
|
|
||||||
23, \
|
|
||||||
22, \
|
|
||||||
21, \
|
|
||||||
20, \
|
|
||||||
19, \
|
|
||||||
18, \
|
|
||||||
17, \
|
|
||||||
16, \
|
|
||||||
15, \
|
|
||||||
14, \
|
|
||||||
13, \
|
|
||||||
12, \
|
|
||||||
11, \
|
|
||||||
10, \
|
|
||||||
9, \
|
|
||||||
8, \
|
|
||||||
7, \
|
|
||||||
6, \
|
|
||||||
5, \
|
|
||||||
4, \
|
|
||||||
3, \
|
|
||||||
2, \
|
|
||||||
1, ), )
|
|
||||||
#else // BOOST_MSVC
|
|
||||||
# define MOCK_VARIADIC_SIZE(...) \
|
|
||||||
MOCK_VARIADIC_SIZE_I(__VA_ARGS__, \
|
|
||||||
32, \
|
|
||||||
31, \
|
|
||||||
30, \
|
|
||||||
29, \
|
|
||||||
28, \
|
|
||||||
27, \
|
|
||||||
26, \
|
|
||||||
25, \
|
|
||||||
24, \
|
|
||||||
23, \
|
|
||||||
22, \
|
|
||||||
21, \
|
|
||||||
20, \
|
|
||||||
19, \
|
|
||||||
18, \
|
|
||||||
17, \
|
|
||||||
16, \
|
|
||||||
15, \
|
|
||||||
14, \
|
|
||||||
13, \
|
|
||||||
12, \
|
|
||||||
11, \
|
|
||||||
10, \
|
|
||||||
9, \
|
|
||||||
8, \
|
|
||||||
7, \
|
|
||||||
6, \
|
|
||||||
5, \
|
|
||||||
4, \
|
|
||||||
3, \
|
|
||||||
2, \
|
|
||||||
1, )
|
|
||||||
#endif // BOOST_MSVC
|
|
||||||
#define MOCK_VARIADIC_SIZE_I(e0, \
|
|
||||||
e1, \
|
|
||||||
e2, \
|
|
||||||
e3, \
|
|
||||||
e4, \
|
|
||||||
e5, \
|
|
||||||
e6, \
|
|
||||||
e7, \
|
|
||||||
e8, \
|
|
||||||
e9, \
|
|
||||||
e10, \
|
|
||||||
e11, \
|
|
||||||
e12, \
|
|
||||||
e13, \
|
|
||||||
e14, \
|
|
||||||
e15, \
|
|
||||||
e16, \
|
|
||||||
e17, \
|
|
||||||
e18, \
|
|
||||||
e19, \
|
|
||||||
e20, \
|
|
||||||
e21, \
|
|
||||||
e22, \
|
|
||||||
e23, \
|
|
||||||
e24, \
|
|
||||||
e25, \
|
|
||||||
e26, \
|
|
||||||
e27, \
|
|
||||||
e28, \
|
|
||||||
e29, \
|
|
||||||
e30, \
|
|
||||||
e31, \
|
|
||||||
size, \
|
|
||||||
...) \
|
|
||||||
size
|
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_AUX_AUX(Name, n, Array) \
|
#define MOCK_CONSTRAINT_AUX_AUX(Name, n, Array) \
|
||||||
MOCK_CONSTRAINT_EXT(Name, n, BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_BACK(Array)), BOOST_PP_ARRAY_ELEM(n, Array))
|
MOCK_CONSTRAINT_EXT(Name, n, BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_BACK(Array)), BOOST_PP_ARRAY_ELEM(n, Array))
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_AUX(Name, Size, Tuple) MOCK_CONSTRAINT_AUX_AUX(Name, BOOST_PP_DEC(Size), (Size, Tuple))
|
#define MOCK_CONSTRAINT_AUX(Name, Size, Tuple) MOCK_CONSTRAINT_AUX_AUX(Name, BOOST_PP_DEC(Size), (Size, Tuple))
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT(Name, ...) MOCK_CONSTRAINT_AUX(Name, MOCK_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__))
|
#define MOCK_CONSTRAINT(Name, ...) MOCK_CONSTRAINT_AUX(Name, BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__))
|
||||||
|
|
||||||
#endif // MOCK_CONSTRAINT_HPP_INCLUDED
|
#endif // MOCK_CONSTRAINT_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ namespace mock { namespace detail {
|
||||||
wrapper& in(sequence& s0, MockSequences&... s)
|
wrapper& in(sequence& s0, MockSequences&... s)
|
||||||
{
|
{
|
||||||
using expander = int[];
|
using expander = int[];
|
||||||
(void)expander{ (e_->add(s0), 0), (e_->add(s), 0)... };
|
(void)expander{ (this->e_->add(s0), 0), (this->e_->add(s), 0)... };
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue