//The following copied from: /* From: "Robert Ramey" Newsgroups: gmane.comp.lib.boost.user Subject: challange to MPL gurus Date: Mon, 12 Dec 2011 11:41:09 -0800 */ #include #include #include #include #include #include #include #include #include #include #include namespace boost{namespace mpl{ template struct ForwardIterator { template < typename StateIter > struct next_deref : next { typedef typename deref::type t1 //What's this used for? //Is there supposed to be some //concept check on this type also? ; BOOST_MPL_ASSERT (( is_convertible < typename StateIter::category , forward_iterator_tag > )) //Is this not redundant? Why not //just check this once in ForwardSequence? //If StateIter is forarward iter, //then isn't next::type also //forward iter? ; }; typedef typename if_recur < identity , not_ < boost::is_same < arg<1> , IterEnd > > , next_deref > >::type type; }; template struct ForwardSequence { typedef typename begin::type iter_beg; typedef typename end::type iter_end; BOOST_CONCEPT_ASSERT(( ForwardIterator )); }; void test_list_sequence(){ BOOST_CONCEPT_ASSERT(( ForwardSequence< list > )); } }}