fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using std::string;
  5. using std::cout;
  6.  
  7. struct fstream{
  8. fstream(const string &){}
  9. fstream(const fstream &) = delete;
  10. };
  11.  
  12. fstream open_file(const string &file_name){
  13. return fstream(file_name);
  14. }
  15.  
  16. void load_map(){
  17. string file_name = "mapa.txt";
  18. fstream file = open_file(file_name);
  19. }
  20.  
  21.  
  22. int main() {
  23. load_map();
  24. return 0;
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'fstream open_file(const string&)':
prog.cpp:13:26: error: use of deleted function 'fstream::fstream(const fstream&)'
  return fstream(file_name);
                          ^
prog.cpp:9:2: note: declared here
  fstream(const fstream &) = delete;
  ^
prog.cpp: In function 'void load_map()':
prog.cpp:18:39: error: use of deleted function 'fstream::fstream(const fstream&)'
     fstream file = open_file(file_name);
                                       ^
prog.cpp:9:2: note: declared here
  fstream(const fstream &) = delete;
  ^
stdout
Standard output is empty