Boost logo

Boost Users :

From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2007-10-02 17:35:29


On 10/2/07, Josh Brown <jbrown_at_[hidden]> wrote:
> Hello,
>
> First off, I apologize if this is a redundant post, I'm relatively new
> to Boost and I couldn't find a link to a list archive and a google
> search didn't merit anything either.

There are links to GMane and others here:
http://www.boost.org/more/mailing_lists.htm#users

> I'm using the preprocessor lib to generate a class definition from a
> sequence of sequences. I want to be able to make the last element of
> each sequence optional and generate additional code based on if the last
> parameter exists. I'm currently testing for the length of the sequence
> in a BOOST_PP_IF statement to see if it has the optional last
> parameter. The problem is that both the true and false result
> expressions are being expanded and then the correct one is selected
> based on the evaluation; which in my case causes an error. I boiled
> down my problem to a fairly simple example:

[snip]

> The root of my problem seems to stem from the fact that BOOST_PP_IF
> expands both the true and false expressions before it does the if test
> and just outputs the already expanded expression. Is this correct; and
> if so, is there a way around it? Or are there any obvious other
> solutions to my problem that the boost experts can suggest :)

You'll want to look into BOOST_PP_TUPLE_EAT -
http://www.boost.org/libs/preprocessor/doc/ref/tuple_eat.html

--Michael Fawcett


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