Remove double serialization when stringifying std::optional
This commit is contained in:
parent
928e198ef2
commit
d65ee04b74
1 changed files with 2 additions and 4 deletions
|
@ -388,13 +388,11 @@ namespace Catch {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct StringMaker<std::optional<T> > {
|
struct StringMaker<std::optional<T> > {
|
||||||
static std::string convert(const std::optional<T>& optional) {
|
static std::string convert(const std::optional<T>& optional) {
|
||||||
ReusableStringStream rss;
|
|
||||||
if (optional.has_value()) {
|
if (optional.has_value()) {
|
||||||
rss << ::Catch::Detail::stringify(*optional);
|
return ::Catch::Detail::stringify(*optional);
|
||||||
} else {
|
} else {
|
||||||
rss << "{ }";
|
return "{ }";
|
||||||
}
|
}
|
||||||
return rss.str();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue