fork(1) download
  1. #include <iostream>
  2.  
  3. template <typename T> std::string debug_rep(const T& t)
  4. {
  5. std::ostringstream ret(t);
  6. return ret.str();
  7. }
  8.  
  9. template <typename T> std::string debug_rep2(const T& t)
  10. {
  11. std::ostringstream ret;
  12. ret << t;
  13. return ret.str();
  14. }
  15.  
  16. int main() {
  17. // your code goes here
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘std::__cxx11::string debug_rep(const T&)’:
prog.cpp:6:12: error: invalid use of incomplete type ‘std::ostringstream {aka class std::__cxx11::basic_ostringstream<char>}’
  return ret.str();
            ^
In file included from /usr/include/c++/6/ios:38:0,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/iosfwd:104:11: note: declaration of ‘std::ostringstream {aka class std::__cxx11::basic_ostringstream<char>}’
     class basic_ostringstream;
           ^~~~~~~~~~~~~~~~~~~
prog.cpp: In function ‘std::__cxx11::string debug_rep2(const T&)’:
prog.cpp:13:12: error: invalid use of incomplete type ‘std::ostringstream {aka class std::__cxx11::basic_ostringstream<char>}’
  return ret.str();
            ^
In file included from /usr/include/c++/6/ios:38:0,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/iosfwd:104:11: note: declaration of ‘std::ostringstream {aka class std::__cxx11::basic_ostringstream<char>}’
     class basic_ostringstream;
           ^~~~~~~~~~~~~~~~~~~
stdout
Standard output is empty