#ifndef BOOST_MPL_RUNTIME_CONTAINS_IF_HPP #define BOOST_MPL_RUNTIME_CONTAINS_IF_HPP #include #include #include #include namespace boost { namespace mpl { namespace detail { template< typename Iterator, typename EndIterator > struct contains_predicate_executor { template< typename Predicate > static bool execute( Predicate pred ) { if(pred( (typename boost::mpl::deref::type*)0 )) return true; typedef typename boost::mpl::next< Iterator >::type NextIterator; return contains_predicate_executor< NextIterator, EndIterator >::execute( pred ); } }; template< typename EndIterator > struct contains_predicate_executor< EndIterator, EndIterator > { template< typename Predicate > static bool execute( Predicate ) { return false; } }; }; template< typename Sequence_, typename Predicate_ > bool runtime_contains_if(Predicate_ pred) { return detail::contains_predicate_executor < typename boost::mpl::begin< Sequence_ >::type , typename boost::mpl::end< Sequence_ >::type >::execute( pred ); } }} #endif