Created
September 24, 2017 02:50
-
-
Save rayhamel/27502fd39f1f550af6e787f89f7f3851 to your computer and use it in GitHub Desktop.
Abuse of the C++ language
This file contains hidden or 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
/* https://wandbox.org/permlink/69aE7gIqBcWonJB0 */ | |
constexpr auto operator""_times(unsigned long long i) noexcept | |
{ | |
return [i](auto &&f) { | |
for (auto n{i}; --n; f()); | |
return f(); | |
}; | |
} | |
#define repeat ([&]{ | |
#define done }); | |
// #include <iostream> | |
// using namespace std; | |
// int main() | |
// { | |
// int n; | |
// cin >> n; | |
// 9_times repeat | |
// cout << --n << '\n'; | |
// done | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment