Store Opt/Arg hint and description as StringRef

There is no good reason for these to be std::strings, as these
are just (optional) constants for nice user output. This ends up
reducing the allocations significantly.

When measuring allocations when running no tests, the changes are
`tests/SelfTest` 9213 -> 7705
`tests/ExtraTests/NoTests` 3723 -> 2215
This commit is contained in:
Martin Hořeňovský committed 2023-12-26 14:40:45 +01:00
1 parent 2b69a3e216
commit 2295d2c8cc
2 files changed
+12 -11

No files matched your search

+1 -1
View File
@@ -185,7 +185,7 @@ namespace Catch {
}
if (!m_hint.empty())
oss << " <" << m_hint << '>';
return { { oss.str(), m_description } };
return { { oss.str(), static_cast<std::string>(m_description) } };
}
bool Opt::isMatch(std::string const& optToken) const {