cppx-core
repeat.hpp
Go to the documentation of this file.
1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi").
2 
3 #include <cppx-core/language/syntax/macro-use.hpp> // CPPX_USE_STD
4 #include <cppx-core/language/types/signed-size-types.hpp> // cppx::(Index, Size)
5 
6 namespace cppx
7 {
8  CPPX_USE_STD( forward );
9 
10  template< class Func, class... Args >
11  void repeat( const Size n, const Func& f, Args&&... args )
12  {
13  for( Index i = 0; i < n; ++i )
14  {
15  f( forward<Args>( args )... );
16  }
17  }
18 }
CPPX_USE_STD(basic_string, basic_string_view, bitset, char_traits, size)
Size Index
Same as Size but with name signifying use as index.
Signed_< size_t > Size
A Signed_ equivalent of size_t.
Macros for generating more concise and clear using statements, primarily $use_cppx and $use_std,...
void repeat(const Size n, const Func &f, Args &&... args)
Definition: repeat.hpp:11
Signed Size and Index, plus unsigned equivalents Unsigned_size and Unsigned_index.