rayhamel
9/24/2017 - 2:50 AM

Abuse of the C++ language

Abuse of the C++ language

/* 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
// }