Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:56

0001 
0002 #ifndef BOOST_MPL_INDEX_IF_HPP_INCLUDED
0003 #define BOOST_MPL_INDEX_IF_HPP_INCLUDED
0004 
0005 // Copyright Eric Friedman 2003
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/aux_/find_if_pred.hpp>
0018 #include <boost/mpl/begin_end.hpp>
0019 #include <boost/mpl/if.hpp>
0020 #include <boost/mpl/int.hpp>
0021 #include <boost/mpl/iter_fold_if.hpp>
0022 #include <boost/mpl/next.hpp>
0023 #include <boost/mpl/void.hpp>
0024 #include <boost/mpl/aux_/na_spec.hpp>
0025 #include <boost/mpl/aux_/lambda_support.hpp>
0026 #include <boost/type_traits/is_same.hpp>
0027 
0028 namespace boost { namespace mpl {
0029 
0030 template<
0031       typename BOOST_MPL_AUX_NA_PARAM(Sequence)
0032     , typename BOOST_MPL_AUX_NA_PARAM(Predicate)
0033     >
0034 struct index_if
0035 {
0036     typedef typename iter_fold_if<
0037           Sequence
0038         , int_<0>
0039         , next<>
0040         , aux::find_if_pred<Predicate>
0041         >::type result_;
0042 
0043     typedef typename end<Sequence>::type not_found_;
0044     typedef typename first<result_>::type result_index_;
0045     typedef typename second<result_>::type result_iterator_;
0046 
0047     typedef typename if_<
0048           is_same< result_iterator_,not_found_ >
0049         , void_
0050         , result_index_
0051         >::type type;
0052 
0053     BOOST_MPL_AUX_LAMBDA_SUPPORT(2,index_if,(Sequence,Predicate))
0054 };
0055 
0056 BOOST_MPL_AUX_NA_SPEC(2, index_if)
0057 
0058 }}
0059 
0060 #endif // BOOST_MPL_INDEX_IF_HPP_INCLUDED