Created
February 16, 2019 01:43
-
-
Save playmer/c3463db9ca6f33b77661d16c1b83a92e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Given by beached from the include<c++> discord | |
// "if you want to be fancy, throw in a noexcept( std::is_nothrow_invokable_v<Function> )" | |
template<typename Function> | |
constexpr void do_n( size_t count, Function func ) { | |
while( count-- > 0 ) { | |
std::invoke( func ); | |
} | |
} | |
std::vector<int> v{} | |
do_n( 1000, [&v]( ) { v.emplace_back( .... ); } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment