diff options
| author | Martin Hořeňovský | 2019-10-29 23:38:21 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-10-31 16:19:56 +0100 |
| commit | 2c6ace04a74458003506befea9291f5e60078bae (patch) | |
| tree | bf57795f37075268e76d7a09ea45ab4c3a65ea08 /examples | |
| parent | 7c48ea6016831f3e6afab0a902022dd59e417f82 (diff) | |
| download | catch3-2c6ace04a74458003506befea9291f5e60078bae.tar.gz | |
Redo build matrix on .travis for C++14 and up
* Use Xenial as the base distribution
* Remove C++11 builds
* Add a lot more C++14 builds
* Add some C++17 builds
* Include newer versions of Clang and GCC
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/231-Cfg-OutputStreams.cpp | 11 | ||||
| -rw-r--r-- | examples/301-Gen-MapTypeConversion.cpp | 8 |
2 files changed, 14 insertions, 5 deletions
diff --git a/examples/231-Cfg-OutputStreams.cpp b/examples/231-Cfg-OutputStreams.cpp index efa99971..2f42c297 100644 --- a/examples/231-Cfg-OutputStreams.cpp +++ b/examples/231-Cfg-OutputStreams.cpp @@ -10,11 +10,12 @@ #define CATCH_CONFIG_MAIN #include <catch2/catch.hpp> + class out_buff : public std::stringbuf { std::FILE* m_stream; public: - out_buff(std::FILE* stream) :m_stream(stream) {} - ~out_buff() { pubsync(); } + out_buff(std::FILE* stream):m_stream(stream) {} + ~out_buff(); int sync() { int ret = 0; for (unsigned char c : str()) { @@ -29,6 +30,12 @@ public: } }; +out_buff::~out_buff() { pubsync(); } + +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wexit-time-destructors" // static variables in cout/cerr/clog +#endif + namespace Catch { std::ostream& cout() { static std::ostream ret(new out_buff(stdout)); diff --git a/examples/301-Gen-MapTypeConversion.cpp b/examples/301-Gen-MapTypeConversion.cpp index b6377e99..88772971 100644 --- a/examples/301-Gen-MapTypeConversion.cpp +++ b/examples/301-Gen-MapTypeConversion.cpp @@ -22,15 +22,17 @@ public: } } - std::string const& get() const override { - return m_line; - } + std::string const& get() const override; bool next() override { return !!std::getline(m_stream, m_line); } }; +std::string const& LineGenerator::get() const { + return m_line; +} + // This helper function provides a nicer UX when instantiating the generator // Notice that it returns an instance of GeneratorWrapper<std::string>, which // is a value-wrapper around std::unique_ptr<IGenerator<std::string>>. |