|
|
|||
File indexing completed on 2025-12-15 09:53:05
0001 /*! 0002 @file 0003 Forward declares `boost::hana::repeat`. 0004 0005 Copyright Louis Dionne 2013-2022 0006 Distributed under the Boost Software License, Version 1.0. 0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 0008 */ 0009 0010 #ifndef BOOST_HANA_FWD_REPEAT_HPP 0011 #define BOOST_HANA_FWD_REPEAT_HPP 0012 0013 #include <boost/hana/config.hpp> 0014 #include <boost/hana/core/when.hpp> 0015 0016 0017 namespace boost { namespace hana { 0018 //! Invokes a nullary function `n` times. 0019 //! @ingroup group-IntegralConstant 0020 //! 0021 //! Given an `IntegralConstant` `n` and a nullary function `f`, 0022 //! `repeat(n, f)` will call `f` `n` times. In particular, any 0023 //! decent compiler should expand `repeat(n, f)` to 0024 //! @code 0025 //! f(); f(); ... f(); // n times total 0026 //! @endcode 0027 //! 0028 //! 0029 //! @param n 0030 //! An `IntegralConstant` holding a non-negative value representing 0031 //! the number of times `f` should be repeatedly invoked. 0032 //! 0033 //! @param f 0034 //! A function to repeatedly invoke `n` times. `f` is allowed to have 0035 //! side effects. 0036 //! 0037 //! 0038 //! Example 0039 //! ------- 0040 //! @include example/repeat.cpp 0041 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0042 constexpr auto repeat = [](auto const& n, auto&& f) -> void { 0043 f(); f(); ... f(); // n times total 0044 }; 0045 #else 0046 template <typename N, typename = void> 0047 struct repeat_impl : repeat_impl<N, when<true>> { }; 0048 0049 struct repeat_t { 0050 template <typename N, typename F> 0051 constexpr void operator()(N const& n, F&& f) const; 0052 }; 0053 0054 BOOST_HANA_INLINE_VARIABLE constexpr repeat_t repeat{}; 0055 #endif 0056 }} // end namespace boost::hana 0057 0058 #endif // !BOOST_HANA_FWD_REPEAT_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|