I am trying to implement concept checking for a couple of MPL concepts as
part of a large project. I've having a heck of a time with some aspects of
this.
The example below illustrates one of the problems I'm having.
The intent is to test the concept. for next<I>, the concept
check is invoked recurrsively until the end of iteration is
encountered. (I'm assuming it's a list in this test). But the
is_end branch is always invoked leading to failure
on both MSVC 9.0 and gcc 4.5.3 compilers
I'll be quite impressed with anyone who can figure out
how to make this work.
Robert Ramey
template<typename I>
struct ForwardIterator {
template<typename B>
struct is_end {};
template<>
struct is_end {
typedef typename deref<I>::type t1;
typedef typename next<I>::type t2;
BOOST_CONCEPT_ASSERT(( ForwardIterator<t2> ));
};
typedef typename boost::mpl::print<
I
>::type t1;
typedef typename is_end<
typename boost::is_same<
boost::mpl::l_iterboost::mpl::l_end,
I
>
> type;
BOOST_MPL_ASSERT((
is_convertible<
typename I::category,
forward_iterator_tag
>
));
};
template<typename S>
struct ForwardSequence {
typedef typename end<S>::type t2;
BOOST_CONCEPT_ASSERT(( ForwardIterator<t2> ));
};
#include
void test_list_sequence(){
BOOST_CONCEPT_ASSERT(( boost::mpl::ForwardSequence<
boost::mpl::list
>
));
}