Boost logo

Boost :

From: Jaap Suter (J.Suter_at_[hidden])
Date: 2003-03-14 02:22:30


In some of my MPL-using code I needed set-based functionality. So I wrote a
function that does an insertion into an ordered list of constants. However,
it seems that if I compare a list created from a bunch of constants to an
explicit list, they don't end up the same. I've attached the example code

I'm wondering whether somebody can spot any errors in my code, or that I'm
probably confused about the way types propagate through meta-functions

All help is greatly appreciated.


Jaap Suter


template < class N, class L >
struct add_to_sorted_list
    typedef typename mpl::if_<
        typename mpl::contains< L, N >::type,
        typename mpl::insert< L,
            typename mpl::lower_bound< L,
                mpl::less< mpl::_, mpl::_ >
>::type type;

typedef mpl::list_c< int, 0, 1, 2, 3 > list0;
typedef mpl::list_c< int, 0, 1, 3 > list1;
typedef add_to_sorted_list<
                mpl::integral_c< int, 2 >,
>::type result;

BOOST_STATIC_ASSERT( is_same< list0, result >::value ); // THIS FAILS;

Boost list run by bdawes at, gregod at, cpdaniel at, john at