diff options
| author | Martin Hořeňovský | 2021-10-03 20:19:32 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-10-03 20:19:36 +0200 |
| commit | d65ee04b74cc166e98fdb409568bfbc9f40da40f (patch) | |
| tree | 43cf65419aaebb7c00b1964dc5582270c22ef359 /src | |
| parent | 928e198ef289c2c259ad0d6ee2b3741c3a2b185a (diff) | |
| download | catch3-d65ee04b74cc166e98fdb409568bfbc9f40da40f.tar.gz | |
Remove double serialization when stringifying std::optional
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/catch_tostring.hpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp index e82552bf..b718a18b 100644 --- a/src/catch2/catch_tostring.hpp +++ b/src/catch2/catch_tostring.hpp @@ -388,13 +388,11 @@ namespace Catch { template<typename T> struct StringMaker<std::optional<T> > { static std::string convert(const std::optional<T>& optional) { - ReusableStringStream rss; if (optional.has_value()) { - rss << ::Catch::Detail::stringify(*optional); + return ::Catch::Detail::stringify(*optional); } else { - rss << "{ }"; + return "{ }"; } - return rss.str(); } }; } |