Created
November 7, 2013 14:40
-
-
Save nurettin/7355640 to your computer and use it in GitHub Desktop.
ruby in my c++
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
#include <functional> | |
struct Times | |
{ | |
unsigned long long t; | |
Times(unsigned long long t) | |
: t(t) | |
{} | |
void operator()(std::function<void(unsigned long long)> block) | |
{ | |
for(unsigned long long n= 0; n< t; ++ n) | |
block(n); | |
} | |
}; | |
Times operator "" _times(unsigned long long t) | |
{ | |
return Times(t); | |
} | |
#define DO ([&](int i){ | |
#define END }); | |
#include <iostream> | |
int main() | |
{ | |
100_times DO | |
std::cout<< "ruby"; | |
END | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment