BVB Source Codes

mars Show iter_fold_if.hpp Source code

Return Download mars: download iter_fold_if.hpp Source code - Download mars Source code - Type:.hpp
  1.  
  2. #ifndef BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
  3. #define BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
  4.  
  5. // Copyright Aleksey Gurtovoy 2003-2004
  6. // Copyright Eric Friedman 2003
  7. //
  8. // Distributed under the Boost Software License, Version 1.0.
  9. // (See accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. //
  12. // See http://www.boost.org/libs/mpl for documentation.
  13.  
  14. // $Id$
  15. // $Date$
  16. // $Revision$
  17.  
  18. #include <boost/mpl/begin_end.hpp>
  19. #include <boost/mpl/logical.hpp>
  20. #include <boost/mpl/always.hpp>
  21. #include <boost/mpl/eval_if.hpp>
  22. #include <boost/mpl/if.hpp>
  23. #include <boost/mpl/pair.hpp>
  24. #include <boost/mpl/apply.hpp>
  25. #include <boost/mpl/aux_/iter_fold_if_impl.hpp>
  26. #include <boost/mpl/aux_/na_spec.hpp>
  27. #include <boost/mpl/aux_/lambda_support.hpp>
  28. #include <boost/mpl/aux_/config/forwarding.hpp>
  29. #include <boost/mpl/aux_/config/workaround.hpp>
  30.  
  31. #include <boost/type_traits/is_same.hpp>
  32.  
  33. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost { namespace mpl {
  34.  
  35. namespace aux {
  36.  
  37. template< typename Predicate, typename LastIterator >
  38. struct iter_fold_if_pred
  39. {
  40.     template< typename State, typename Iterator > struct apply
  41. #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
  42.         : and_<
  43.               not_< is_same<Iterator,LastIterator> >
  44.             , apply1<Predicate,Iterator>
  45.             >
  46.     {
  47. #else
  48.     {
  49.         typedef and_<
  50.               not_< is_same<Iterator,LastIterator> >
  51.             , apply1<Predicate,Iterator>
  52.             > type;
  53. #endif
  54.     };
  55. };
  56.  
  57. } // namespace aux
  58.  
  59. template<
  60.       typename BOOST_MPL_AUX_NA_PARAM(Sequence)
  61.     , typename BOOST_MPL_AUX_NA_PARAM(State)
  62.     , typename BOOST_MPL_AUX_NA_PARAM(ForwardOp)
  63.     , typename BOOST_MPL_AUX_NA_PARAM(ForwardPredicate)
  64.     , typename BOOST_MPL_AUX_NA_PARAM(BackwardOp)
  65.     , typename BOOST_MPL_AUX_NA_PARAM(BackwardPredicate)
  66.     >
  67. struct iter_fold_if
  68. {
  69.  
  70.     typedef typename begin<Sequence>::type first_;
  71.     typedef typename end<Sequence>::type last_;
  72.  
  73.     typedef typename eval_if<
  74.           is_na<BackwardPredicate>
  75.         , if_< is_na<BackwardOp>, always<false_>, always<true_> >
  76.         , identity<BackwardPredicate>
  77.         >::type backward_pred_;
  78.  
  79. // cwpro8 doesn't like 'cut-off' type here (use typedef instead)
  80. #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
  81.     struct result_ :
  82. #else
  83.     typedef
  84. #endif
  85.         aux::iter_fold_if_impl<
  86.           first_
  87.         , State
  88.         , ForwardOp
  89.         , protect< aux::iter_fold_if_pred< ForwardPredicate,last_ > >
  90.         , BackwardOp
  91.         , backward_pred_
  92.         >
  93. #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
  94.     { };
  95. #else
  96.     result_;
  97. #endif
  98.  
  99. public:
  100.  
  101.     typedef pair<
  102.           typename result_::state
  103.         , typename result_::iterator
  104.         > type;
  105.  
  106.     BOOST_MPL_AUX_LAMBDA_SUPPORT(
  107.           6
  108.         , iter_fold_if
  109.         , (Sequence,State,ForwardOp,ForwardPredicate,BackwardOp,BackwardPredicate)
  110.         )
  111. };
  112.  
  113. BOOST_MPL_AUX_NA_SPEC(6, iter_fold_if)
  114.  
  115. }}
  116.  
  117. #endif // BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
  118.  
downloaditer_fold_if.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top