1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/mpl/index_if.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,60 @@
1.4 +
1.5 +#ifndef BOOST_MPL_INDEX_IF_HPP_INCLUDED
1.6 +#define BOOST_MPL_INDEX_IF_HPP_INCLUDED
1.7 +
1.8 +// Copyright Eric Friedman 2003
1.9 +//
1.10 +// Distributed under the Boost Software License, Version 1.0.
1.11 +// (See accompanying file LICENSE_1_0.txt or copy at
1.12 +// http://www.boost.org/LICENSE_1_0.txt)
1.13 +//
1.14 +// See http://www.boost.org/libs/mpl for documentation.
1.15 +
1.16 +// $Source: /cvsroot/boost/boost/boost/mpl/index_if.hpp,v $
1.17 +// $Date: 2004/09/02 15:40:41 $
1.18 +// $Revision: 1.7 $
1.19 +
1.20 +#include <boost/mpl/aux_/find_if_pred.hpp>
1.21 +#include <boost/mpl/begin_end.hpp>
1.22 +#include <boost/mpl/if.hpp>
1.23 +#include <boost/mpl/int.hpp>
1.24 +#include <boost/mpl/iter_fold_if.hpp>
1.25 +#include <boost/mpl/next.hpp>
1.26 +#include <boost/mpl/void.hpp>
1.27 +#include <boost/mpl/aux_/na_spec.hpp>
1.28 +#include <boost/mpl/aux_/lambda_support.hpp>
1.29 +#include <boost/type_traits/is_same.hpp>
1.30 +
1.31 +namespace boost { namespace mpl {
1.32 +
1.33 +template<
1.34 + typename BOOST_MPL_AUX_NA_PARAM(Sequence)
1.35 + , typename BOOST_MPL_AUX_NA_PARAM(Predicate)
1.36 + >
1.37 +struct index_if
1.38 +{
1.39 + typedef typename iter_fold_if<
1.40 + Sequence
1.41 + , int_<0>
1.42 + , next<>
1.43 + , aux::find_if_pred<Predicate>
1.44 + >::type result_;
1.45 +
1.46 + typedef typename end<Sequence>::type not_found_;
1.47 + typedef typename first<result_>::type result_index_;
1.48 + typedef typename second<result_>::type result_iterator_;
1.49 +
1.50 + typedef typename if_<
1.51 + is_same< result_iterator_,not_found_ >
1.52 + , void_
1.53 + , result_index_
1.54 + >::type type;
1.55 +
1.56 + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,index_if,(Sequence,Predicate))
1.57 +};
1.58 +
1.59 +BOOST_MPL_AUX_NA_SPEC(2, index_if)
1.60 +
1.61 +}}
1.62 +
1.63 +#endif // BOOST_MPL_INDEX_IF_HPP_INCLUDED