#include namespace mpl = boost::mpl; #include #include #include #include #include #include #include #include #include #include using namespace boost::type_erasure; //#define FOO_RETURNS_PAIR template struct foo_concept { #ifdef FOO_RETURNS_PAIR typedef std::pair result_type; static result_type apply(C& c) { return std::make_pair(c.begin(),c.end()); } #else typedef TIterator result_type; static result_type apply(C& c) { return c.begin(); } #endif }; /*namespace boost { namespace type_erasure { template struct concept_interface< ::foo_concept, Base, C> : Base { typedef typename rebind_any::type iterator; #ifdef FOO_RETURNS_PAIR std::pair foo() #else iterator foo() #endif { return call(::foo_concept(), *this); } }; } }*/ template struct container_iterator_impl { typedef typename C::iterator type; }; template struct container_iterator { typedef typename mpl::eval_if< is_placeholder , void* , container_iterator_impl >::type type; }; struct _iterator : public placeholder {}; template struct something_with_begin : public mpl::vector< relaxed_match , same_type >, _iterator> , foo_concept<_iterator, C> //, constructible //, destructible , copy_constructible // , copy_constructible<_b> // , typeid_<_b> > { }; int main(int argc, char* argv[]) { typedef any > anything_with_begin; std::vector v; anything_with_begin c(v); return 0; }