Skip to content

Instantly share code, notes, and snippets.

@nurettin
Created November 7, 2013 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nurettin/7355640 to your computer and use it in GitHub Desktop.
Save nurettin/7355640 to your computer and use it in GitHub Desktop.
ruby in my c++
#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