• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Boost.Wave: A Standard compliant C++ preprocessor library
3     http://www.boost.org/
4 
5     Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
6     Software License, Version 1.0. (See accompanying file
7     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
9 
10 // Test partial macro evaluation using varidic macros
11 
12 //O --variadics
13 
14 #define cat(...) cat_i(__VA_ARGS__,,,,,)
15 #define cat_i(a, b, c, d, e, ...) \
16     a ## b ## c ## d ## e \
17     /**/
18 
19 #define primitive_cat(a, b) a ## b
20 
21 #define partial_cat(x, y) cat(partial_cat_, x, y)
22 
23 #define partial_cat_00(a, b) partial_cat_f(, ## a, b ## ,)
24 #define partial_cat_01(a, b) partial_cat_f(, ## a, b    ,)
25 #define partial_cat_10(a, b) partial_cat_f(,    a, b ## ,)
26 #define partial_cat_11(a, b) partial_cat_f(,    a, b    ,)
27 
28 #define partial_cat_f(a, b, c, d) b ## c
29 
30 #define X Token1
31 #define Y Token2
32 
33 //R #line 34 "t_1_032.cpp"
34 partial_cat(0, 0)(X, Y)     //R XY
35 partial_cat(0, 1)(X, Y)     //R XToken2
36 partial_cat(1, 0)(X, Y)     //R Token1Y
37 partial_cat(1, 1)(X, Y)     //R Token1Token2
38