1// (C) Copyright Gennadiy Rozental 2001.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6// See http://www.boost.org/libs/test for the library home page.
7//
8//!@file
9//!@brief few helpers for working with variadic macros
10// ***************************************************************************
11
12#ifndef BOOST_TEST_PP_VARIADIC_HPP_021515GER
13#define BOOST_TEST_PP_VARIADIC_HPP_021515GER
14
15// Boost
16#include <boost/preprocessor/control/iif.hpp>
17#include <boost/preprocessor/comparison/equal.hpp>
18#include <boost/preprocessor/variadic/size.hpp>
19
20//____________________________________________________________________________//
21
22#if BOOST_PP_VARIADICS
23
24#if BOOST_PP_VARIADICS_MSVC
25# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) BOOST_PP_CAT( tool (__VA_ARGS__), )
26#else
27# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) tool (__VA_ARGS__)
28#endif
29
30//____________________________________________________________________________//
31
32/// if sizeof(__VA_ARGS__) == N: F1(__VA_ARGS__)
33/// else: F2(__VA_ARGS__)
34#define BOOST_TEST_INVOKE_IF_N_ARGS( N, F1, F2, ... ) \
35 BOOST_TEST_INVOKE_VARIADIC( \
36 BOOST_PP_IIF( \
37 BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), N), \
38 F1, \
39 F2), \
40 __VA_ARGS__ ) \
41/**/
42
43//____________________________________________________________________________//
44
45#endif /* BOOST_PP_VARIADICS */
46
47#endif // BOOST_TEST_PP_VARIADIC_HPP_021515GER
48
49// EOF
50

source code of boost/boost/test/detail/pp_variadic.hpp