/*============================================================================= Copyright (c) 2003 Joel de Guzman Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_ALGORITHM_DETAIL_FIND_IF_HPP) #define FUSION_ALGORITHM_DETAIL_FIND_IF_HPP #include #include #include #include #include #include namespace boost { namespace fusion { namespace detail { template struct apply_filter { typedef typename mpl::apply1< Pred , typename meta::value_of::type >::type type; }; template struct main_find_if; template struct recursive_find_if { typedef typename main_find_if< typename meta::next::type, Last, Pred >::type type; }; template struct main_find_if { typedef mpl::or_< meta::equal_to , apply_filter > filter; typedef typename mpl::eval_if< filter , mpl::identity , recursive_find_if >::type type; }; template struct static_find_if { typedef typename main_find_if< First , Last , typename mpl::lambda::type >::type type; template static type call(Iterator const& iter, mpl::true_) { return iter; }; template static type call(Iterator const& iter, mpl::false_) { return call(fusion::next(iter)); }; template static type call(Iterator const& iter) { typedef meta::equal_to found; return call(iter, found()); }; }; }}} #endif