3 Forward declares `boost::hana::repeat`.
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_REPEAT_HPP
11 #define BOOST_HANA_FWD_REPEAT_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Invokes a nullary function `n` times.
19 //! @ingroup group-IntegralConstant
21 //! Given an `IntegralConstant` `n` and a nullary function `f`,
22 //! `repeat(n, f)` will call `f` `n` times. In particular, any
23 //! decent compiler should expand `repeat(n, f)` to
25 //! f(); f(); ... f(); // n times total
30 //! An `IntegralConstant` holding a non-negative value representing
31 //! the number of times `f` should be repeatedly invoked.
34 //! A function to repeatedly invoke `n` times. `f` is allowed to have
40 //! @include example/repeat.cpp
41 #ifdef BOOST_HANA_DOXYGEN_INVOKED
42 constexpr auto repeat = [](auto const& n, auto&& f) -> void {
43 f(); f(); ... f(); // n times total
46 template <typename N, typename = void>
47 struct repeat_impl : repeat_impl<N, when<true>> { };
50 template <typename N, typename F>
51 constexpr void operator()(N const& n, F&& f) const;
54 constexpr repeat_t repeat{};
56 BOOST_HANA_NAMESPACE_END
58 #endif // !BOOST_HANA_FWD_REPEAT_HPP