mirror of
https://github.com/catchorg/Catch2.git
synced 2025-10-28 13:41:53 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user