fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <int x>
  5. struct F {
  6. static std::string msg;
  7. };
  8.  
  9. template <int x>
  10. std::string F<x>::msg;
  11.  
  12. int main() {
  13. F<1>::msg = "Hello ";
  14. F<2>::msg = "world!\n";
  15. cout << F<1>::msg << F<2>::msg;
  16. return 0;
  17. }
Success #stdin #stdout 0s 5600KB
stdin
Standard input is empty
stdout
Hello world!