#include #include namespace mpl=boost::mpl; struct do_until_functor_base { template bool operator()(F)const{return false;} }; template struct do_until_functor_step:Base { template bool operator()(F f)const { if(Base::operator()(f))return true; boost::value_initialized t; return f(boost::get(t)); } }; template struct do_until_functor: mpl::fold< Seq, do_until_functor_base, do_until_functor_step >::type {}; template bool do_until(F f) { do_until_functor d; return d(f); } /**** testing ****/ #include #include #include template struct verbose_is_same { template bool operator()(Q)const { static const bool b=boost::is_same::value; std::cout< v1; do_until(verbose_is_same()); }