Make IStream::stream non-const

This way it makes much more sense from logically-const point
of view, and also means that concrete implementations don't
have to always have a `mutable` keyword on the stream member.
This commit is contained in:
Martin Hořeňovský
2022-04-12 20:59:01 +02:00
parent 9934b7de13
commit 4f09f1120b
11 changed files with 32 additions and 32 deletions

View File

@@ -21,9 +21,9 @@ namespace {
};
class TestStringStream : public Catch::IStream {
mutable std::stringstream m_stream;
std::stringstream m_stream;
public:
std::ostream& stream() const override {
std::ostream& stream() override {
return m_stream;
}

View File

@@ -29,10 +29,10 @@
namespace {
class StringIStream : public Catch::IStream {
public:
std::ostream& stream() const override { return sstr; }
std::ostream& stream() override { return sstr; }
std::string str() const { return sstr.str(); }
private:
mutable std::stringstream sstr;
std::stringstream sstr;
};
}