fork download
  1. #include <iostream>
  2.  
  3. template<char... str>
  4. struct staticString {
  5. static std::string c_str() {
  6. return std::string{str...}.c_str();
  7. }
  8. };
  9.  
  10. int main() {
  11. std::cout<<staticString<'t', 'e', 's', 't'>().c_str();
  12. return 0;
  13. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
test