Advertisement
RobertDeMilo

RB5.12 Опасности return

Apr 17th, 2024
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. pair<ifstream, ofstream> MakeStreams(const string& prefix)
  7. {
  8.     //  ifstream input(prefix+ " .in");
  9.     //  ofstream output(prefix+ " .out");
  10.     // 
  11.     //  return {move(input), move(output)};
  12.     //  // input, output -> pair ctor -> returned temporary
  13.  
  14.     return {ifstream(prefix+ " .in"),ofstream(prefix+ " .out")};
  15.     // input, output -> pair ctor -> returned temporary
  16. }
  17.  
  18. ifstream MakeInputStream(const string& prefix)
  19. {
  20. //  auto streams = MakeStreams(prefix);
  21. //  return move(streams.first);
  22.     return MakeStreams(prefix).first;
  23. }
  24.  
  25. int main()
  26. {
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement