Last active
March 1, 2017 19:40
-
-
Save stek29/50a1d114d44116da77a44375f7ee4890 to your computer and use it in GitHub Desktop.
null created by stek291 - https://repl.it/GDHf/1
This file contains 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 <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