1 # /* ************************************************************************** 2 # * * 3 # * (C) Copyright Edward Diener 2011. 4 # * Distributed under the Boost Software License, Version 1.0. (See 5 # * accompanying file LICENSE_1_0.txt or copy at 6 # * http://www.boost.org/LICENSE_1_0.txt) 7 # * * 8 # ************************************************************************** */ 9 # 10 # /* See http://www.boost.org for most recent version. */ 11 # 12 # include <boost/preprocessor/variadic.hpp> 13 # include <boost/preprocessor/array/size.hpp> 14 # include <boost/preprocessor/array/elem.hpp> 15 # include <boost/preprocessor/list/at.hpp> 16 # include <boost/preprocessor/list/size.hpp> 17 # include <boost/preprocessor/seq/elem.hpp> 18 # include <boost/preprocessor/seq/size.hpp> 19 # include <boost/preprocessor/tuple/size.hpp> 20 # include <boost/preprocessor/tuple/elem.hpp> 21 # include <libs/preprocessor/test/test.h> 22 23 #if BOOST_PP_VARIADICS 24 25 #define VDATA 0,1,2,3,4,5,6 26 #define VDATA_LARGE 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 27 #define VDATA_VERY_LARGE 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 28 29 BEGIN BOOST_PP_VARIADIC_ELEM(4,VDATA) == 4 END 30 BEGIN BOOST_PP_VARIADIC_ELEM(6,7,11,3,8,14,85,56,92,165) == 56 END 31 BEGIN BOOST_PP_VARIADIC_ELEM(29,VDATA_LARGE) == 29 END 32 BEGIN BOOST_PP_VARIADIC_ELEM(57,VDATA_VERY_LARGE) == 57 END 33 BEGIN BOOST_PP_VARIADIC_ELEM(35, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) == 35 END 34 BEGIN BOOST_PP_VARIADIC_SIZE(VDATA) == 7 END 35 BEGIN BOOST_PP_VARIADIC_SIZE(7,11,3,8,14,85,56,92,165) == 9 END 36 BEGIN BOOST_PP_VARIADIC_SIZE(VDATA_LARGE) == 33 END 37 BEGIN BOOST_PP_VARIADIC_SIZE(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) == 33 END 38 BEGIN BOOST_PP_VARIADIC_SIZE(VDATA_VERY_LARGE) == 64 END 39 BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_VARIADIC_TO_ARRAY(VDATA)) == 7 END 40 BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_VARIADIC_TO_ARRAY(VDATA_VERY_LARGE)) == 64 END 41 BEGIN BOOST_PP_ARRAY_ELEM(4,BOOST_PP_VARIADIC_TO_ARRAY(7,11,3,8,14,85,56,92,165)) == 14 END 42 BEGIN BOOST_PP_ARRAY_ELEM(30,BOOST_PP_VARIADIC_TO_ARRAY(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 30 END 43 BEGIN BOOST_PP_LIST_AT(BOOST_PP_VARIADIC_TO_LIST(VDATA),3) == 3 END 44 BEGIN BOOST_PP_LIST_AT(BOOST_PP_VARIADIC_TO_LIST(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63),49) == 49 END 45 BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_VARIADIC_TO_LIST(7,11,3,8,14,85,56,92,165)) == 9 END 46 BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_VARIADIC_TO_LIST(VDATA_LARGE)) == 33 END 47 BEGIN BOOST_PP_SEQ_ELEM(5,BOOST_PP_VARIADIC_TO_SEQ(VDATA)) == 5 END 48 BEGIN BOOST_PP_SEQ_ELEM(16,BOOST_PP_VARIADIC_TO_SEQ(VDATA_LARGE)) == 16 END 49 BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_VARIADIC_TO_SEQ(3,78,22,11,3)) == 5 END 50 BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_VARIADIC_TO_SEQ(VDATA_VERY_LARGE)) == 64 END 51 BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_VARIADIC_TO_TUPLE(VDATA)) == 7 END 52 BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_VARIADIC_TO_TUPLE(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) == 64 END 53 BEGIN BOOST_PP_TUPLE_ELEM(8,BOOST_PP_VARIADIC_TO_TUPLE(7,11,3,8,14,85,56,92,165)) == 165 END 54 BEGIN BOOST_PP_TUPLE_ELEM(27,BOOST_PP_VARIADIC_TO_TUPLE(VDATA_LARGE)) == 27 END 55 56 #endif 57