fold.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*!
  2. @file
  3. Forward declares `boost::hana::fold`.
  4. Copyright Louis Dionne 2013-2022
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef BOOST_HANA_FWD_FOLD_HPP
  9. #define BOOST_HANA_FWD_FOLD_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/fwd/fold_left.hpp>
  12. namespace boost { namespace hana {
  13. //! Equivalent to `fold_left`; provided for convenience.
  14. //! @ingroup group-Foldable
  15. //!
  16. //! `fold` is equivalent to `fold_left`. However, it is not tag-dispatched
  17. //! on its own because it is just an alias to `fold_left`. Also note that
  18. //! `fold` can be called with or without an initial state, just like
  19. //! `fold_left`:
  20. //!
  21. //! @code
  22. //! fold(xs, state, f) == fold_left(xs, state, f)
  23. //! fold(xs, f) == fold_left(xs, f)
  24. //! @endcode
  25. //!
  26. //!
  27. //! Example
  28. //! -------
  29. //! @include example/fold.cpp
  30. BOOST_HANA_INLINE_VARIABLE constexpr auto fold = fold_left;
  31. }} // end namespace boost::hana
  32. #endif // !BOOST_HANA_FWD_FOLD_HPP