Skip to content

Instantly share code, notes, and snippets.

@stek29
Last active Mar 1, 2017
Embed
What would you like to do?
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