From 5fd12d32d433c6f511786834d4bebd03aab07055 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 17 Sep 2020 18:25:36 -0400 Subject: [PATCH] Assume variadic macro support. --- doc/data/arrays.html | 6 +- doc/data/tuples.html | 6 +- doc/headers/config/variadics.html | 17 +- doc/ref/overload.html | 2 +- doc/ref/tuple_eat.html | 110 +- doc/ref/tuple_elem.html | 117 +- doc/ref/tuple_enum.html | 109 +- doc/ref/tuple_insert.html | 39 +- doc/ref/tuple_insert_d.html | 28 +- doc/ref/tuple_rem.html | 117 +- doc/ref/tuple_rem_ctor.html | 113 +- doc/ref/tuple_reverse.html | 112 +- doc/ref/tuple_to_array.html | 97 +- doc/ref/tuple_to_list.html | 112 +- doc/ref/tuple_to_seq.html | 98 +- doc/ref/variadics.html | 15 +- doc/topics/emptiness.html | 18 +- doc/topics/file_iteration.html | 4 +- doc/topics/variadic_macros.html | 103 +- .../preprocessor/array/detail/get_data.hpp | 2 +- include/boost/preprocessor/config/config.hpp | 44 +- .../preprocessor/facilities/is_empty.hpp | 37 - .../facilities/is_empty_variadic.hpp | 4 - .../preprocessor/facilities/overload.hpp | 4 +- .../preprocessor/list/for_each_product.hpp | 48 +- include/boost/preprocessor/list/to_array.hpp | 77 +- .../punctuation/is_begin_parens.hpp | 6 +- .../punctuation/remove_parens.hpp | 4 - .../seq/detail/binary_transform.hpp | 17 +- .../preprocessor/seq/variadic_seq_to_seq.hpp | 2 - include/boost/preprocessor/stringize.hpp | 4 - .../tuple/detail/is_single_return.hpp | 4 +- include/boost/preprocessor/tuple/eat.hpp | 41 +- include/boost/preprocessor/tuple/elem.hpp | 186 +- include/boost/preprocessor/tuple/insert.hpp | 5 - .../preprocessor/tuple/limits/eat_128.hpp | 147 - .../preprocessor/tuple/limits/eat_256.hpp | 467 -- .../preprocessor/tuple/limits/eat_64.hpp | 83 - .../preprocessor/tuple/limits/elem_128.hpp | 1169 ----- .../preprocessor/tuple/limits/elem_256.hpp | 3918 ----------------- .../preprocessor/tuple/limits/elem_64.hpp | 147 - .../preprocessor/tuple/limits/rem_128.hpp | 403 -- .../preprocessor/tuple/limits/rem_256.hpp | 1171 ----- .../preprocessor/tuple/limits/rem_64.hpp | 82 - include/boost/preprocessor/tuple/pop_back.hpp | 5 - .../boost/preprocessor/tuple/pop_front.hpp | 5 - .../boost/preprocessor/tuple/push_back.hpp | 5 - .../boost/preprocessor/tuple/push_front.hpp | 6 - include/boost/preprocessor/tuple/rem.hpp | 74 +- include/boost/preprocessor/tuple/remove.hpp | 5 - include/boost/preprocessor/tuple/replace.hpp | 5 - include/boost/preprocessor/tuple/reverse.hpp | 42 +- include/boost/preprocessor/tuple/size.hpp | 24 +- include/boost/preprocessor/tuple/to_array.hpp | 30 +- include/boost/preprocessor/tuple/to_list.hpp | 42 +- include/boost/preprocessor/tuple/to_seq.hpp | 42 +- .../preprocessor/variadic/detail/has_opt.hpp | 2 +- .../variadic/detail/is_single_return.hpp | 4 +- include/boost/preprocessor/variadic/elem.hpp | 169 +- .../boost/preprocessor/variadic/has_opt.hpp | 2 +- include/boost/preprocessor/variadic/size.hpp | 4 - .../boost/preprocessor/variadic/to_array.hpp | 26 +- .../boost/preprocessor/variadic/to_list.hpp | 14 +- .../boost/preprocessor/variadic/to_seq.hpp | 4 +- .../boost/preprocessor/variadic/to_tuple.hpp | 4 +- include/boost/preprocessor/wstringize.hpp | 4 - test/Jamfile.v2 | 182 +- test/array.cxx | 32 - test/config_info.cpp | 1 - test/cpp_standard.cpp | 22 +- test/facilities.cxx | 4 - test/isempty.cxx | 57 - test/isempty_variadic_standard_failure.cxx | 2 +- test/isempty_variadic_standard_failure2.cxx | 2 +- test/list.cxx | 11 - test/punctuation.cxx | 4 - test/seq.cxx | 10 - test/stringize.cxx | 2 - test/tuple.cxx | 52 - test/variadic.cxx | 4 - 80 files changed, 864 insertions(+), 9334 deletions(-) delete mode 100644 include/boost/preprocessor/tuple/limits/eat_128.hpp delete mode 100644 include/boost/preprocessor/tuple/limits/eat_256.hpp delete mode 100644 include/boost/preprocessor/tuple/limits/eat_64.hpp delete mode 100644 include/boost/preprocessor/tuple/limits/elem_128.hpp delete mode 100644 include/boost/preprocessor/tuple/limits/elem_256.hpp delete mode 100644 include/boost/preprocessor/tuple/limits/elem_64.hpp delete mode 100644 include/boost/preprocessor/tuple/limits/rem_128.hpp delete mode 100644 include/boost/preprocessor/tuple/limits/rem_256.hpp delete mode 100644 include/boost/preprocessor/tuple/limits/rem_64.hpp diff --git a/doc/data/arrays.html b/doc/data/arrays.html index d968c4f..0839d86 100644 --- a/doc/data/arrays.html +++ b/doc/data/arrays.html @@ -24,11 +24,9 @@ 0 size. The notation for an empty array is '(0,())'.

-
With variadic macro support a tuple has all of the +
A tuple has all of the functionality as an array, knows its own size, and is easier - syntactically to use. Because of that an array should be used, as - opposed to a tuple, only if your compiler does not support - variadic macros. The only advantage an array has over a tuple + syntactically to use. The only advantage an array has over a tuple is that an array can be empty while a tuple always has at least one element and therefore can never have a size of 0.

diff --git a/doc/data/tuples.html b/doc/data/tuples.html index 7a93c9b..8f0d876 100644 --- a/doc/data/tuples.html +++ b/doc/data/tuples.html @@ -15,10 +15,8 @@ A tuple cannot be empty. The notation '()' as a tuple is a single element tuple of size 1, where the element is empty.
Tuples are fast and easy to use.  With variadic macro - support it is not necessary to know the size of a tuple; without - variadic macro support all access to tuples requires - knowledge of its size. Use a tuple instead of an array if - your compiler supports variadic macros, since a tuple has all of + support it is not necessary to know the size of a tuple. + Use a tuple instead of an array, since a tuple has all of the functionality as an array and is easier syntactically to use. The only functionality an array has which a tuple does not have is that an array can be empty whereas a tuple cannot diff --git a/doc/headers/config/variadics.html b/doc/headers/config/variadics.html index 385c1ab..d907a96 100644 --- a/doc/headers/config/variadics.html +++ b/doc/headers/config/variadics.html @@ -8,26 +8,23 @@
The config/config.hpp - header defines internal configuration macros as well as macros for - determining variadic macro support and for determining whether the - compiler's preprocessor conforms to the standard. The file - is automatically included whenever any Boost PP macros are used. - The end-user can manually - include it in order to use the BOOST_PP_VARIADICS macro or the - BOOST_PP_IS_STANDARD macro, but normally should never have to do - so.
+ header defines internal configuration macros as well as a macro + for determining whether the compiler's preprocessor conforms to + the standard. The file is automatically included whenever any + Boost PP macros are used.The end-user can manually include it + in order to use the BOOST_PP_IS_STANDARD macro, but normally + should never have to do so.

Usage

#include <boost/preprocessor/config/config.hpp>

Contents


© Copyright Edward Diener - 2011,2014
+ 2011,2014,2020

Distributed under the Boost Software License, Version 1.0. (See accompanying file boost/preprocessor/facilities/overload.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>

#define MACRO_1(number) MACRO_2(number,10)
#define MACRO_2(number1,number2) BOOST_PP_ADD(number1,number2)

#if !BOOST_PP_VARIADICS_MSVC

#define MACRO_ADD_NUMBERS(...) BOOST_PP_OVERLOAD(MACRO_,__VA_ARGS__)(__VA_ARGS__)

#else

// or for Visual C++

#define MACRO_ADD_NUMBERS(...) \
BOOST_PP_CAT(BOOST_PP_OVERLOAD(MACRO_,__VA_ARGS__)(__VA_ARGS__),BOOST_PP_EMPTY())

#endif

MACRO_ADD_NUMBERS(5) // output is 15
MACRO_ADD_NUMBERS(3,6) // output is 9 +

#include <boost/preprocessor/facilities/overload.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>

#define MACRO_1(number) MACRO_2(number,10)
#define MACRO_2(number1,number2) BOOST_PP_ADD(number1,number2)

#if !BOOST_PP_VARIADICS_MSVC

#define MACRO_ADD_NUMBERS(...) BOOST_PP_OVERLOAD(MACRO_,__VA_ARGS__)(__VA_ARGS__)

#else

// or for Visual C++'s default preprocessor

#define MACRO_ADD_NUMBERS(...) \
BOOST_PP_CAT(BOOST_PP_OVERLOAD(MACRO_,__VA_ARGS__)(__VA_ARGS__),BOOST_PP_EMPTY())

#endif

MACRO_ADD_NUMBERS(5) // output is 15
MACRO_ADD_NUMBERS(3,6) // output is 9

© Copyright Edward Diener diff --git a/doc/ref/tuple_eat.html b/doc/ref/tuple_eat.html index f1d7c1c..f75b9ca 100644 --- a/doc/ref/tuple_eat.html +++ b/doc/ref/tuple_eat.html @@ -1,58 +1,64 @@ + + + BOOST_PP_TUPLE_EAT - + -
- The BOOST_PP_TUPLE_EAT macro expands to a macro that eats a tuple. -
-

Usage

-
- BOOST_PP_TUPLE_EAT(size)
-
-or
-
-BOOST_PP_TUPLE_EAT(size) (v)
-
-

Arguments

-
-
size
-
- The size of the tuple to be eaten.  - Valid tuple sizes range from 1 to BOOST_PP_LIMIT_TUPLE. -
-
-

Remarks

-
- The size argument must be the actual size of the tuple in the non-variadic version.
-
For the variadic version (v) the -size may be left out -completely so that the macro can be invoked as BOOST_PP_TUPLE_EAT(); you may get a warning from some compilers, but the -functionality will still work. If you specify a size in the variadic -version, it will be ignored, but the warning from some compilers will -not occur.
-
-

See Also

- -

Requirements

-
- Header:  <boost/preprocessor/tuple/eat.hpp> -
-

Sample Code

-
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/tuple/eat.hpp>

#define OP(a, b) (a b)

#define MACRO(n) BOOST_PP_IF(n, OP, BOOST_PP_TUPLE_EAT(2))(1, 2)

// or for the variadic version (v)

#define MACRO(n) BOOST_PP_IF(n, OP, BOOST_PP_TUPLE_EAT())(1, 2)

MACRO(0) // expands to nothing
MACRO(1) // expands to (1, 2)
-
-
- © Copyright Housemarque Oy 2002 -
© Copyright Paul Mensonides 2002
-
© Copyright Edward Diener 2011,2013
-
-
-

Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

-
+
The BOOST_PP_TUPLE_EAT macro + expands to a macro that eats a tuple.
+

Usage

+
BOOST_PP_TUPLE_EAT() (v)
+
+ or
+
+ BOOST_PP_TUPLE_EAT(size) (v)
+
+

Arguments

+
+
size
+
The size of the tuple to be eaten.  The argument + is ignored.
+
+
+

Remarks

+
The + size may be left out + completely so that the macro can be invoked as + BOOST_PP_TUPLE_EAT(); you may get a warning from some compilers, + but the + functionality will still work. If you specify a size, it will be + ignored, but the warning from some compilers will + not occur.
+
+

See Also

+ +

Requirements

+
Header:  <boost/preprocessor/tuple/eat.hpp> +
+

Sample Code

+
+
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/tuple/eat.hpp>

#define OP(a, b) (a b)
#define MACRO(n) BOOST_PP_IF(n, OP, BOOST_PP_TUPLE_EAT())(1, 2)

MACRO(0) // expands to nothing
MACRO(1) // expands to (1, 2)
+
+
+
© Copyright Housemarque Oy + 2002
+ © Copyright Paul Mensonides 2002
+
© Copyright Edward Diener 2011,2013,2020
+
+
+

Distributed under the Boost Software License, Version + 1.0. (See accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

+
- \ No newline at end of file + diff --git a/doc/ref/tuple_elem.html b/doc/ref/tuple_elem.html index ac57f3f..368f5b5 100644 --- a/doc/ref/tuple_elem.html +++ b/doc/ref/tuple_elem.html @@ -1,65 +1,64 @@ + + + BOOST_PP_TUPLE_ELEM - + -
- The BOOST_PP_TUPLE_ELEM macro extracts an element from a tuple. -
-

Usage

-
- BOOST_PP_TUPLE_ELEM(size, i, tuple)
-
-or
-
-BOOST_PP_TUPLE_ELEM(...) (v)
-
-

Arguments

-
-
size
-
- The size of the tuple.  - Valid tuple sizes range from 1 to BOOST_PP_LIMIT_TUPLE.  -
-
i
-
- The zero-based index into the tuple of the element to be extracted.  - Valid values range from 0 to size - 1. -
-
tuple
-
- The tuple from which an element is to be extracted. -
-
-

Remarks

-
- The size argument must be the actual size of the tuple, - and i must be less than the size of the tuple.
-
You can - invoke the variadic version as BOOST_PP_TUPLE_ELEM(i,tuple) or - BOOST_PP_TUPLE_ELEM(size,i,tuple). -
-

See Also

- -

Requirements

-
- Header:  <boost/preprocessor/tuple/elem.hpp> -
-

Sample Code

-
#include <boost/preprocessor/tuple/elem.hpp>

#define TUPLE (a, b, c, d)

BOOST_PP_TUPLE_ELEM(4, 0, TUPLE) // expands to a
BOOST_PP_TUPLE_ELEM(4, 3, TUPLE) // expands to d

// or for the variadic version (v)

BOOST_PP_TUPLE_ELEM(0, TUPLE) // expands to a in the variadic version
BOOST_PP_TUPLE_ELEM(3, TUPLE) // expands to d in the variadic version
-
-
- © Copyright Housemarque Oy 2002 -
© Copyright Paul Mensonides 2002
-
© Copyright Edward Diener 2011,2013
-
-
-

Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

-
+
The BOOST_PP_TUPLE_ELEM + macro extracts an element from a tuple.
+

Usage

+
BOOST_PP_TUPLE_ELEM(i, tuple) + (v)
+
+ or
+
+ BOOST_PP_TUPLE_ELEM(size, i, tuple) + (v)
+
+

Arguments

+
+
size
+
The size of the tuple.  The size is ignored.
+
+
i
+
The zero-based index into the tuple of the element to + be extracted.  Valid values range from 0 to size + - 1.
+
tuple
+
The tuple from which an element is to be extracted.
+
+

Remarks

+
You can invoke the variadic macro as BOOST_PP_TUPLE_ELEM(i,tuple), + or BOOST_PP_TUPLE_ELEM(size,i,tuple) for + backward compatibility.
+

See Also

+ +

Requirements

+
Header:  <boost/preprocessor/tuple/elem.hpp> +
+

Sample Code

+
+
#include <boost/preprocessor/tuple/elem.hpp>

#define TUPLE (a, b, c, d)

BOOST_PP_TUPLE_ELEM(0, TUPLE) // expands to a in the variadic version
BOOST_PP_TUPLE_ELEM(3, TUPLE) // expands to d in the variadic version
+
+
+
© Copyright Housemarque Oy + 2002
+ © Copyright Paul Mensonides 2002
+
© Copyright Edward Diener 2011,2013,2020
+
+
+

Distributed under the Boost Software License, Version + 1.0. (See accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

+
- \ No newline at end of file + diff --git a/doc/ref/tuple_enum.html b/doc/ref/tuple_enum.html index 310bfff..318f2eb 100644 --- a/doc/ref/tuple_enum.html +++ b/doc/ref/tuple_enum.html @@ -1,55 +1,68 @@ + + + BOOST_PP_TUPLE_ENUM -
The BOOST_PP_TUPLE_ENUM macro converts a tuple to its comma-separated elements. The comma-separated elements are in the form of variadic data.
-

Usage

-
BOOST_PP_TUPLE_ENUM(size,tuple)
-
-or
-
-BOOST_PP_TUPLE_ENUM(...) (v)
-
-

Arguments

-
-
size
-
- The size of the tuple.  - Valid tuple sizes range from 1 to BOOST_PP_LIMIT_TUPLE.
-
-
tuple
-
The tuple whose elements are to be converted.
-
-

Remarks

-
-
You can -invoke the variadic version (v) as BOOST_PP_TUPLE_ENUM(tuple) or -BOOST_PP_TUPLE_ENUM(size,tuple).
-
-

See Also

- -

Requirements

-
Header:  <boost/preprocessor/tuple/enum.hpp> -
-

Sample Code

-
-
#include <boost/preprocessor/tuple/enum.hpp>

#define TUPLE (B,O,O,S,T)

BOOST_PP_TUPLE_ENUM(5,TUPLE) // expands to B, O, O, S, T

// or for the variadic version (v)

BOOST_PP_TUPLE_ENUM(TUPLE) // expands to B, O, O, S, T
-
-
-
© Copyright Housemarque Oy 2002 -
-© Copyright Paul Mensonides 2002
-
© Copyright Edward Diener 2011,2013
-
-
-

Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

-
+
The BOOST_PP_TUPLE_ENUM + macro converts a tuple to its comma-separated + elements. The comma-separated elements are in the form of variadic + data.
+

Usage

+
BOOST_PP_TUPLE_ENUM(tuple) (v)
+
+ or
+
+ BOOST_PP_TUPLE_ENUM(size,tuple) (v)
+
+

Arguments

+
+
size
+
The size of the tuple.  The size is ignored.
+
+
tuple
+
The tuple whose elements are to be converted.
+
+

Remarks

+
+ You can + invoke the variadic macro (v) + as BOOST_PP_TUPLE_ENUM(tuple) or + BOOST_PP_TUPLE_ENUM(size,tuple) for backward + compatibility.
+
+

See Also

+ +

Requirements

+
Header:  <boost/preprocessor/tuple/enum.hpp> +
+

Sample Code

+
+
#include <boost/preprocessor/tuple/enum.hpp>

#define TUPLE (B,O,O,S,T)

BOOST_PP_TUPLE_ENUM(TUPLE) // expands to B, O, O, S, T
+
+
+
© Copyright Housemarque Oy + 2002 +
+ © Copyright Paul Mensonides 2002
+
© Copyright Edward Diener 2011,2013,2020
+
+
+

Distributed under the Boost Software License, Version + 1.0. + (See accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

+
- \ No newline at end of file + diff --git a/doc/ref/tuple_insert.html b/doc/ref/tuple_insert.html index 0c58681..ade88ff 100644 --- a/doc/ref/tuple_insert.html +++ b/doc/ref/tuple_insert.html @@ -1,33 +1,35 @@ + - + BOOST_PP_TUPLE_INSERT -
The BOOST_PP_TUPLE_INSERT macro - inserts an element into an tuple.
+
The BOOST_PP_TUPLE_INSERT + macro inserts an element into an tuple.

Usage

-
BOOST_PP_TUPLE_INSERT(tuple, i, elem) - (v)
+
BOOST_PP_TUPLE_INSERT(tuple, i, + elem) (v)

Arguments

tuple
The tuple into which an element is to be inserted.
i
-
The zero-based position in tuple where an element is to be - inserted.  Valid values range from 0 to BOOST_PP_TUPLE_SIZE(tuple).
+
The zero-based position in tuple where an element is + to be inserted.  Valid values range from 0 to BOOST_PP_TUPLE_SIZE(tuple).
elem
The element to insert.

Remarks

This macro inserts elem before the element at index i.
-
If the operation attempts to create an tuple that is larger - than BOOST_PP_LIMIT_TUPLE, the result is undefined.
-
This macro uses BOOST_PP_WHILE interally.  Therefore, to - use the d parameter passed from other macros that use BOOST_PP_WHILE, - see BOOST_PP_TUPLE_INSERT_D.
+
If the operation attempts to create an tuple that is + larger than BOOST_PP_LIMIT_TUPLE, the result is undefined.
+
This macro uses BOOST_PP_WHILE interally.  + Therefore, to use the d parameter passed from other macros + that use BOOST_PP_WHILE, see BOOST_PP_TUPLE_INSERT_D.

See Also

+ +
-
© Copyright Edward Diener 2013
+
© Copyright Edward Diener 2013 +
-

Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

+

Distributed under the Boost Software License, Version + 1.0. (See accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

diff --git a/doc/ref/tuple_insert_d.html b/doc/ref/tuple_insert_d.html index 53fbea1..a471577 100644 --- a/doc/ref/tuple_insert_d.html +++ b/doc/ref/tuple_insert_d.html @@ -1,16 +1,18 @@ + - + BOOST_PP_TUPLE_INSERT_D -
The BOOST_PP_TUPLE_INSERT_D macro - inserts an element into a tuple.  It reenters BOOST_PP_WHILE +
The BOOST_PP_TUPLE_INSERT_D + macro inserts an element into a tuple.  It reenters BOOST_PP_WHILE with maximum efficiency.

Usage

BOOST_PP_TUPLE_INSERT_D(d, tuple, - i, elem) (v)
+ i, elem)

Arguments

d
@@ -18,16 +20,16 @@
tuple
The tuple into which an element is to be inserted.
i
-
The zero-based position in tuple where an element is to be - inserted.  Valid values range from 0 to BOOST_PP_TUPLE_SIZE(tuple).
+
The zero-based position in tuple where an element is + to be inserted.  Valid values range from 0 to BOOST_PP_TUPLE_SIZE(tuple).
elem
The element to insert.

Remarks

This macro inserts elem before the element at index i.
-
If the operation attempts to create an tuple that is larger - than BOOST_PP_LIMIT_TUPLE, the result is undefined.
+
If the operation attempts to create an tuple that is + larger than BOOST_PP_LIMIT_TUPLE, the result is undefined.

See Also