Boost logo

Boost Users :

From: Ed Keith (e_d_k_at_[hidden])
Date: 2008-05-06 10:40:20


--- Peter Bartlett <pete_at_[hidden]> wrote:

> 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";
> }
>

Your right it's not doing what I want. Let me ask a
hight level question.

What I am trying to do is the following:

I have two sequences. Both represent sets, one is a
subset of the other. What I want to do is for each
element in the superset, generate one value if it is
in the subset, and another value if it is not in the
subset. The problem is that the elements are not
numeric (they are just tokens), so I can not seem to
compare them to determine if they are the same.

Any sugestions?

Thank you,

   -EdK

Ed Keith
e_d_k_at_[hidden]

Blog: edkeith.blogspot.com

      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


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