Boost logo

Boost Users :

From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2008-05-06 10:50:11


> 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?

What I woukld write is borrowed from the inner mechanics of Boost::PP.
let's say you have two token FOO & BAR.

#define IS_SAME_TOKEN_FOO_FOO 1
#define IS_SAME_TOKEN_FOO_BAR 0
#define IS_SAME_TOKEN_BAR_FOO 0
#define IS_SAME_TOKEN_BAR_BAR 0

#define IS_SAME_TOKEN(X,Y)
BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(IS_SAME_TOKEN_,X),_),Y)

then use IS_SAME_TOKEN in BOOST_PP_IF

I knwo it gets cumbersome as the number of tokens increase but I can't
see hwo to do it better.


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