Boost logo

Boost Users :

From: Peter Bartlett (pete_at_[hidden])
Date: 2008-05-06 10:08:37


Quoting Ed Keith <e_d_k_at_[hidden]>:

>
> --- Peter Bartlett <pete_at_[hidden]> wrote:
>
>> Quoting Ed Keith <e_d_k_at_[hidden]>:
>>
>> > [...]
>> >
>> > BOOST_PP_IF(abc == abc, foo, bar)
>> >
>> > I get an error.
>> >
>> > Is it possible to do something like this? If so,
>> what
>> > am I doing wrong?
>>
>> I think you have to use BOOST_PP_IF(
>> BOOST_PP_EQUAL(abc,abc) , foo,
>> bar ) here.
>
> I tried that, but apparently BOOST_PP_EQUAL only takes
> int values.
>
> Thank for the suggestion though,
>
> -EdK

Ok. BOOST_PP_IF has a similar restriction, so you probably can't do
what you want with it. Be sure though that even the '#if' version is
doing what you want - for example the following program prints 1 on my
compiler (VC9):

#if foo == bar
   int baz() { return 1; }
#else
   int baz() { return 0; }
#endif

#include <iostream>
int main()
{
   std::cout << "\n" << baz() << "\n";
}


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