From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-07-04 11:05:26
Does this mean that BOOST_PREPROCESSOR_EQUAL will also make an appearance?
To full MACROize Boost.Function I need something like:
#define ADAPTABLE_UNARY() typedef T0 argument_type;
#define ADAPTABLE_BINARY() typedef T0 first_argument_type; \
typedef T1 second_argument_type;
Thanks for all your great work on this library.
On Saturday 30 June 2001 03:46, you wrote:
> A few hours ago, I invented a technique for implementing ADD(X,Y) and
> SUB(X,Y) using linear amount of tokens. In other words, code like this does
> what you'd expect:
> assert(BOOST_PREPROCESSOR_ADD(5,10) == 15);
> assert(BOOST_PREPROCESSOR_SUB(10,5) == 5);
> The solution is a repetition primitive that repeatedly calls the specified
> macro with the specified parameter (here without the prefix):
> #define REPEAT_CALL(N,M,P) REPEAT_CALL_DELAY(N,M,P)
> #define REPEAT_CALL_DELAY(N,M,P) REPEAT_CALL##N(M,P)
> #define REPEAT_CALL0(M,P)
> #define REPEAT_CALL1(M,P) M(P)
> #define REPEAT_CALL2(M,P) M(M(P))
> #define REPEAT_CALL3(M,P) REPEAT_CALL2(M,M(P))
> #define REPEAT_CALL4(M,P) REPEAT_CALL3(M,M(P))
> #define REPEAT_CALL5(M,P) REPEAT_CALL4(M,M(P))
> // ...
> In other words, this evaluates to something like:
> The ADD and SUB primitives are then implemented like this:
> #define BOOST_PREPROCESSOR_ADD(X,Y)\
> #define BOOST_PREPROCESSOR_SUB(X,Y)\
> I have also made some updates, based on review comments, to the library
> If you want, I can update the library files, so that you can test and try
> the new ADD and SUB primitives.
> It is highly likely that other interesting and useful operations could be
> implemented in the future.
> Info: http://www.boost.org Unsubscribe:
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk