Boost logo

Boost :

From: Daniel James (daniel_at_[hidden])
Date: 2004-09-03 11:03:31


Daniel James wrote:
> Sorry about all these tests and thanks for your patience. Here's another
> one which uses a slightly different method that I think should will better:

Actually, can you also preprocess this test? I really think this one
will work. Which probably means it won't.

#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/punctuation/paren.hpp>

#define IS_NULLARY(x) BOOST_PP_SEQ_ELEM(1, (IS_NULLARY_C x)(0))
#define IS_NULLARY_C() ~ BOOST_PP_RPAREN() (1) BOOST_PP_LPAREN() ~

IS_NULLARY(()) // 1
IS_NULLARY(()abc) // 1
IS_NULLARY(+) // 0
IS_NULLARY(xyz) // 0

#define IS_UNARY(x) IS_NULLARY(IS_UNARY_C x)
#define IS_UNARY_C(a) ()

IS_UNARY((a)) // 1
IS_UNARY((a)abc) // 1
IS_UNARY(+) // 0
IS_UNARY(xyz) // 0


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk