3 Forward declares `boost::hana::for_each`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_FOR_EACH_HPP
11 #define BOOST_HANA_FWD_FOR_EACH_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Perform an action on each element of a foldable, discarding
19 //! the result each time.
20 //! @ingroup group-Foldable
22 //! Iteration is done from left to right, i.e. in the same order as when
23 //! using `fold_left`. If the structure is not finite, this method will
28 //! The structure to iterate over.
31 //! A function called as `f(x)` for each element `x` of the structure.
32 //! The result of `f(x)`, whatever it is, is ignored.
37 //! @include example/for_each.cpp
38 #ifdef BOOST_HANA_DOXYGEN_INVOKED
39 constexpr auto for_each = [](auto&& xs, auto&& f) -> void {
43 template <typename T, typename = void>
44 struct for_each_impl : for_each_impl<T, when<true>> { };
47 template <typename Xs, typename F>
48 constexpr void operator()(Xs&& xs, F&& f) const;
51 constexpr for_each_t for_each{};
53 BOOST_HANA_NAMESPACE_END
55 #endif // !BOOST_HANA_FWD_FOR_EACH_HPP