fork(1) download
  1. #include <iostream>
  2.  
  3. #define STR_1(S,I) (I < sizeof(S) ? S[I] : '\0')
  4. #define STR_2(S,I) STR_1(S,I), STR_1(S,I+1)
  5. #define STR_4(S,I) STR_2(S,I), STR_2(S,I+2)
  6. #define STR_8(S,I) STR_4(S,I), STR_4(S,I+4)
  7. #define STR_16(S,I) STR_8(S,I), STR_8(S,I+8)
  8. #define STR_32(S,I) STR_16(S,I), STR_16(S,I+16)
  9. #define STR(S) STR_32(S,0)
  10.  
  11. template <char... Chars>
  12. struct MyString
  13. {
  14. static constexpr char value[] = { Chars..., '\0' };
  15. };
  16.  
  17. template <char... Chars>
  18. constexpr char MyString<Chars...>::value[];
  19.  
  20. int main()
  21. {
  22. std::cout << MyString<STR("kernel32.dll")>::value << std::endl;
  23. }
  24.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
kernel32.dll