mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-03 06:44:37 +02:00
Added public interface to iter_fold_if.
[SVN r20716]
This commit is contained in:
@@ -19,14 +19,13 @@
|
||||
|
||||
#include "boost/mpl/aux_/config/workaround.hpp"
|
||||
#include "boost/mpl/aux_/find_if_pred.hpp"
|
||||
#include "boost/mpl/aux_/iter_fold_if_impl.hpp"
|
||||
#include "boost/mpl/always.hpp"
|
||||
#include "boost/mpl/begin_end.hpp"
|
||||
#include "boost/mpl/bool.hpp"
|
||||
#include "boost/mpl/if.hpp"
|
||||
#include "boost/mpl/int.hpp"
|
||||
#include "boost/mpl/iter_fold_if.hpp"
|
||||
#include "boost/mpl/lambda.hpp"
|
||||
#include "boost/mpl/next.hpp"
|
||||
#include "boost/mpl/protect.hpp"
|
||||
#include "boost/mpl/void.hpp"
|
||||
#include "boost/mpl/aux_/void_spec.hpp"
|
||||
#include "boost/mpl/aux_/lambda_support.hpp"
|
||||
@@ -56,35 +55,24 @@ template<
|
||||
>
|
||||
struct index_if
|
||||
{
|
||||
private:
|
||||
private:
|
||||
|
||||
typedef typename begin<Sequence>::type first_;
|
||||
typedef typename end<Sequence>::type last_;
|
||||
typedef typename lambda<Predicate>::type pred_;
|
||||
|
||||
// cwpro8 doesn't like 'cut-off' type here (use typedef instead)
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
struct result_ :
|
||||
#else
|
||||
typedef
|
||||
#endif
|
||||
aux::iter_fold_if_impl<
|
||||
typedef typename iter_fold_if<
|
||||
first_
|
||||
, int_<0>
|
||||
, aux::index_if_op
|
||||
, aux::find_if_pred<pred_,last_>
|
||||
, void
|
||||
, always<false_>
|
||||
>
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
{ };
|
||||
#else
|
||||
result_;
|
||||
#endif
|
||||
, protect< aux::index_if_op >
|
||||
, protect< aux::find_if_pred<pred_,last_> >
|
||||
>::type result_;
|
||||
|
||||
typedef typename result_::state result_index_;
|
||||
typedef typename result_::iterator result_iterator_;
|
||||
typedef typename result_::first result_index_;
|
||||
typedef typename result_::second result_iterator_;
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
typedef typename if_<
|
||||
is_same< result_iterator_,last_ >
|
||||
, void_
|
||||
|
83
include/boost/mpl/iter_fold_if.hpp
Normal file
83
include/boost/mpl/iter_fold_if.hpp
Normal file
@@ -0,0 +1,83 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost mpl/iter_fold_if.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2003
|
||||
// Eric Friedman
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both the copyright notice and this permission notice appear in
|
||||
// supporting documentation. No representations are made about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
|
||||
#ifndef BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
|
||||
#define BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
|
||||
|
||||
#include "boost/mpl/aux_/iter_fold_if_impl.hpp"
|
||||
#include "boost/mpl/always.hpp"
|
||||
#include "boost/mpl/bool.hpp"
|
||||
#include "boost/mpl/lambda.hpp"
|
||||
#include "boost/mpl/pair.hpp"
|
||||
#include "boost/mpl/void.hpp"
|
||||
#include "boost/mpl/aux_/void_spec.hpp"
|
||||
#include "boost/mpl/aux_/lambda_support.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace mpl {
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Iterator)
|
||||
, typename BOOST_MPL_AUX_VOID_SPEC_PARAM(State)
|
||||
, typename BOOST_MPL_AUX_VOID_SPEC_PARAM(ForwardOp)
|
||||
, typename BOOST_MPL_AUX_VOID_SPEC_PARAM(ForwardPredicate)
|
||||
, typename BackwardOp = void_
|
||||
, typename BackwardPredicate = always<false_>
|
||||
>
|
||||
struct iter_fold_if
|
||||
{
|
||||
private:
|
||||
|
||||
// cwpro8 doesn't like 'cut-off' type here (use typedef instead)
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
struct result_ :
|
||||
#else
|
||||
typedef
|
||||
#endif
|
||||
aux::iter_fold_if_impl<
|
||||
Iterator
|
||||
, State
|
||||
, typename lambda<ForwardOp>::type
|
||||
, typename lambda<ForwardPredicate>::type
|
||||
, typename lambda<BackwardOp>::type
|
||||
, typename lambda<BackwardPredicate>::type
|
||||
>
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
{ };
|
||||
#else
|
||||
result_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
typedef pair<
|
||||
typename result_::state
|
||||
, typename result_::iterator
|
||||
> type;
|
||||
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(
|
||||
6
|
||||
, iter_fold_if
|
||||
, (Iterator,State,ForwardOp,ForwardPredicate,BackwardOp,BackwardPredicate)
|
||||
)
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_VOID_SPEC(4, iter_fold_if)
|
||||
|
||||
} // namespace mpl
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
|
Reference in New Issue
Block a user