foldl1.hpp 842 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef BOOST_METAPARSE_V1_FOLDL1_HPP
  2. #define BOOST_METAPARSE_V1_FOLDL1_HPP
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include <boost/metaparse/v1/foldl.hpp>
  8. #include <boost/mpl/if.hpp>
  9. namespace boost
  10. {
  11. namespace metaparse
  12. {
  13. namespace v1
  14. {
  15. template <class P, class State, class ForwardOp>
  16. struct foldl1
  17. {
  18. typedef foldl1 type;
  19. template <class S, class Pos>
  20. struct apply :
  21. boost::mpl::if_<
  22. is_error<typename P::template apply<S, Pos> >,
  23. P,
  24. foldl<P, State, ForwardOp>
  25. >::type::template apply<S, Pos>
  26. {};
  27. };
  28. }
  29. }
  30. }
  31. #endif