Boost logo

Boost Users :

From: Simon Buchan (simon_at_[hidden])
Date: 2005-09-29 19:18:07


Noel Belcourt wrote:
> Hi,
>
> I'm new to the list so this may have been answered elsewhere (like a
> FAQ for MPL) but I couldn't find it.
>
> I've got 2 vector_c types like this
>
> typedef vector_c<int, 1,2,1,1,-2,0,1> p1;
> typedef vector_c<int, 0,3,0,-1,1,3,5> p2;
>
> and a resultant type defined as
>
> typedef vector_c<int, 1,1,0,1,1,0,1> r;
>
> that I want to compare at compile time using logic like this
>
> r = p1 || p1 && p2
>
I don't get it: wouldn't p1 match everything that p1 && p2 matches?
Did you mean r == p1 || p1 && p2?

You might try something like:

        transform<p1, p2, or_<_1, and_<_1, _2> > >;

if not. Otherwise, try:

        equal< r, transform<p1, p2, or_<_1, and_<_1, _2> > >::type >;

I don't use MPL, though, so that probbably doesn't work.

<snip>


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