Boost logo

Boost Users :

From: Daniel (boost_at_[hidden])
Date: 2007-02-24 09:08:33


Hi,
I have few Adapter classes. Each of them provide typedef operations
which specifies which operations that Adapter supports (vector_c, with
0 or 1 at appropriate positions). I want to assert that two Adapters
support different operations. However, my code doesn't compile. Any
ideas?

Daniel

template<unsigned int N1, unsigned int N2>
struct Adapter
{
    typedef vector_c<unsigned int, N1, N2> operations;
};

template<class TAdapter1, class TAdapter2>
struct Check
{
    typedef typename transform<
        typename TAdapter1::operations, typename
TAdapter2::operations, plus<_1, _2>
>::type sum_of_operations;

    typedef typename max_element<sum_of_operations>::type max_of_operations;

    BOOST_MPL_ASSERT((less_equal<max_of_operations, int_<1> >));
};

int main()
{
    Check< Adapter<0, 1>, Adapter<1, 0> >();
    return 0;
}


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