|
Boost : |
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-04-12 00:17:49
Below is an implementation that works on MSVC (and probably gcc and EDG).
Can we add the primitive to the library?
Aleksey
#include "boost/preprocessor/seq/size.hpp"
#include "boost/preprocessor/punctuation/paren.hpp"
#include "boost/preprocessor/cat.hpp"
#include "boost/preprocessor/config/config.hpp"
#define BOOST_PP_IS_SEQ(seq) BOOST_PP_IS_SEQ_I(seq)
#define BOOST_PP_IS_SEQ_I(seq) BOOST_PP_CAT(BOOST_PP_IS_SEQ_,
BOOST_PP_IS_SEQ_0 seq BOOST_PP_RPAREN())
#define BOOST_PP_IS_SEQ_0(_) BOOST_PP_IS_SEQ_1(_
#define BOOST_PP_IS_SEQ_ALWAYS_0(_) 0
#define BOOST_PP_IS_SEQ_BOOST_PP_IS_SEQ_0 BOOST_PP_IS_SEQ_ALWAYS_0(
#define BOOST_PP_IS_SEQ_BOOST_PP_IS_SEQ_1(_) 1
// test case
#include "boost/preprocessor/logical/not.hpp"
#include "boost/preprocessor/debug/assert.hpp"
#define SEQ (a)(b)(c)
BOOST_PP_ASSERT( BOOST_PP_NOT(BOOST_PP_IS_SEQ(a)) )
BOOST_PP_ASSERT( BOOST_PP_IS_SEQ((a)) )
BOOST_PP_ASSERT( BOOST_PP_IS_SEQ((a)(b)) )
BOOST_PP_ASSERT( BOOST_PP_IS_SEQ((a)(b)(c)) )
BOOST_PP_ASSERT( BOOST_PP_IS_SEQ(SEQ) )
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk