Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2004-07-14 15:56:23


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Vladimir Prus

> Hello,
> support I have some Boost.Preprocessor data structure, say a sequence:
>
> #define SEQ ("1")("2")("3")
>
> how can I convert it into initalizer {"1", "2", "3"}? E.g:
>
> #define MY_TEST(SEQ) char* var = {
> SOMEHOW_GET_LIST_OF_VALUES(SEQ) }

BOOST_PP_SEQ_ENUM converts a sequence to a comma-separated list. E.g.

#include <boost/preprocessor/seq/enum.hpp>

#define MY_TEST(seq) \
    char* var[] = { BOOST_PP_SEQ_ENUM(seq) } \
    /**/

#define SEQ ("1")("2")("3")

MY_TEST(SEQ); // char* var[] = { "1", "2", "3" };

Regards,
Paul Mensonides


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