Skip to content

Instantly share code, notes, and snippets.

@stek29
Last active March 1, 2017 19: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 stek29/50a1d114d44116da77a44375f7ee4890 to your computer and use it in GitHub Desktop.
Save stek29/50a1d114d44116da77a44375f7ee4890 to your computer and use it in GitHub Desktop.
null created by stek291 - https://repl.it/GDHf/1
#include <iostream>
#include <string>
using namespace std;
int main(void) {
cout <<
"#include <iostream>\n"\
"#include <string>\n"\
"using namespace std;\n"\
"template < size_t N > struct Q { \n"\
" ostream & operator()() { return Q<(N>>6)>()() << ((char)(30+N%64)); }\n"\
"};\n"\
"template < > struct Q<0> { ostream & operator()() { return cout;} };\n"\
"template <class H, class T> struct P { };\n"\
"template < class H > struct V { void operator()() { H()(); } };\n"\
"template < class H, class T > struct V<P<H, T> >{ void operator()() { H()(); V<T>()(); }; };"
<< endl;
{
cout << "// " << flush;
string kekmda;
getline(cin, kekmda);
cout << "typedef";
size_t i, c, j;
for(i = 0; i < ((kekmda.size()-1)/6)*6; i+=6) {
c = 0;
for(auto l: kekmda.substr(i, 6)) c = (c << 6) | ((int) l - 30)%64;
cout << " P< Q<0x" << hex << c << ">,\n";
}
for(c = j = 0; (j+i) < kekmda.size(); j++) c = (c << 6) | ((int) kekmda[j+i] - 30)%64;
for (; j < 6; j++) c<<=6;
cout << " Q<0x" << hex << c << ">\n";
for(; i > 0; i-=6) cout << " >";
cout << "\n K;" << endl;
}
cout << "int main(void) { V<K>()(); return 0;}" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment