Remove double serialization when stringifying std::optional

This commit is contained in:
Martin Hořeňovský 2021-10-03 20:19:32 +02:00
parent 928e198ef2
commit d65ee04b74
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -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();
}
};
}