LIST_FOR_EACH_PRODUCT() added to library

[SVN r12571]
This commit is contained in:
Vesa Karvonen
2002-01-30 10:22:13 +00:00
parent 9d401687ef
commit 18ae25d5e5
3 changed files with 14 additions and 82 deletions

View File

@ -19,6 +19,7 @@
*/
#include <libs/preprocessor/example/array_arithmetic_helpers.hpp>
#include <boost/preprocessor/list/for_each_product.hpp>
#include <boost/preprocessor/list/at.hpp>
#include <boost/preprocessor/list/append.hpp>
#include <boost/preprocessor/tuple/to_list.hpp>
@ -116,7 +117,7 @@
#define IS_VALID_BINARY_OP_AND_TYPE_COMBINATION(O,L,R) BOOST_PP_IF(BOOST_PP_OR(TYPE_IS_FLOATING(L),TYPE_IS_FLOATING(R)),OP_IS_FLOATING(O),1)
/* Generates code for all all unary operators and integral types. */
#define UNARY_ARRAY_OP(_,L) UNARY_ARRAY_OP2(BOOST_PP_LIST_AT(L,1),BOOST_PP_LIST_FIRST(L))
#define UNARY_ARRAY_OP(R,_,L) UNARY_ARRAY_OP2(BOOST_PP_LIST_AT(L,1),BOOST_PP_LIST_FIRST(L))
#define UNARY_ARRAY_OP2(O,T) BOOST_PP_IF(IS_VALID_UNARY_OP_AND_TYPE_COMBINATION(O,T),UNARY_ARRAY_OP3,BOOST_PP_TUPLE2_EAT)(O,T)
#define UNARY_ARRAY_OP3(O,T)\
void BOOST_PP_CAT4(array_,OP_NAME(O),_,TYPE_ABBREVIATION(T))\
@ -126,7 +127,7 @@
BOOST_PP_LIST_FOR_EACH_PRODUCT(UNARY_ARRAY_OP,_,BOOST_PP_TUPLE_TO_LIST(2,(APPLICATIVE_UNARY_OPS,BUILTIN_TYPES)))
/* Generates code for all binary operators and integral type pairs. */
#define BINARY_ARRAY_OP(_,L) BINARY_ARRAY_OP2(BOOST_PP_LIST_AT(L,2),BOOST_PP_LIST_AT(L,1),BOOST_PP_LIST_FIRST(L))
#define BINARY_ARRAY_OP(R,_,L) BINARY_ARRAY_OP2(BOOST_PP_LIST_AT(L,2),BOOST_PP_LIST_AT(L,1),BOOST_PP_LIST_FIRST(L))
#define BINARY_ARRAY_OP2(O,L,R) BOOST_PP_IF(IS_VALID_BINARY_OP_AND_TYPE_COMBINATION(O,L,R),BINARY_ARRAY_OP3,BOOST_PP_TUPLE3_EAT)(O,L,R)
#define BINARY_ARRAY_OP3(O,L,R)\
void BOOST_PP_CAT6(array_,OP_NAME(O),_,TYPE_ABBREVIATION(L),_,TYPE_ABBREVIATION(R))\