I think I\'ll get right into it and start with the code:
#include
#include
#include
class test : public std:
The problem is with this:
test(test&& old) {};
This lets you construct a new test
from an rvalue test
, yes, but it says nothing about your base, which is simply being default constructed (no open file). What you want is this:
test(test&& old) : std::ofstream(std::move(old)) {};
Which will move the stream from old
into the base.
I'm going to answer my own question here:
In the GCC C++0x Library Features page, have a look at item 27.9, which reads:
27.9 - File-based streams - Partial - Missing move and swap operations
I guess that's probably the issue I'm having with gcc.
Does the caller need to know that you are returning an ofstream
, or would it make more sense to return a streambuf
, and let the caller wrap it inside a stream?