Boost logo

Boost Users :

From: Tanton Gibbs (thgibbs_at_[hidden])
Date: 2003-05-02 09:30:07


You can use BOOST_PP_LIST_FOR_EACH

#define ARG_LIST (char, (int, (unsigned int, (long, ...))))
#define DO_IT(r, data, elem) void foo( elem );

BOOST_PP_LIST_FOR_EACH( DO_IT, , ARG_LIST )

The LIST_FOR_EACH macro repeatedly calls DO_IT for every member in ARG_LIST.
In DO_IT, r is the next available LIST_FOR_EACH repetition. data is the
middle argument to LIST_FOR_EACH (in our case, nothing), and elem is the
current element under inspection (char or int or unsigned int, etc...)

HTH,
Tanton
----- Original Message -----
From: "Eric Robert" <synapzzz_at_[hidden]>
To: <Boost-Users_at_[hidden]>
Sent: Thursday, May 01, 2003 5:40 PM
Subject: [Boost-Users] PP library...

> Hi,
>
> I think the preprocessor library could help me here but I'm having
> problems understanding it. Maybe someone will be so kind to explain it
> to me a bit.
> Here is what I want to produce:
>
> void foo(char);
> void foo(int);
> void foo(unsigned int);
> ....
>
> You got the idea. Something that repeats a list of things i.e. here,
> types.
> How can I do that?
>
> Thanks!
> Eric
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net