Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal/catch_assertionresult.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-09-08 14:49:40 +0200
committerMartin Hořeňovský2019-09-08 15:58:10 +0200
commit7b865daccc7bba2dcc25a4f0b9ea7348b1b4d61f (patch)
treed6964f2f65b8fbcd70e8041e16677339f675f261 /include/internal/catch_assertionresult.cpp
parent14362533bb50596049f1b46bcc6d333208576a87 (diff)
downloadcatch3-7b865daccc7bba2dcc25a4f0b9ea7348b1b4d61f.tar.gz
Make StringRef's operator std::string explicit
This way it is explicit when there is a `StringRef` -> `std::string` conversion and makes it easier to look for allocations that could be avoided. Doing this has already removed one allocation per registered test case, as there was a completely pointless `StringRef` -> `std::string` conversion when parsing tags of a test case.
Diffstat (limited to 'include/internal/catch_assertionresult.cpp')
-rw-r--r--include/internal/catch_assertionresult.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/internal/catch_assertionresult.cpp b/include/internal/catch_assertionresult.cpp
index 8f505d04..5da1cfdf 100644
--- a/include/internal/catch_assertionresult.cpp
+++ b/include/internal/catch_assertionresult.cpp
@@ -56,13 +56,13 @@ namespace Catch {
if( isFalseTest( m_info.resultDisposition ) )
return "!(" + m_info.capturedExpression + ")";
else
- return m_info.capturedExpression;
+ return static_cast<std::string>(m_info.capturedExpression);
}
std::string AssertionResult::getExpressionInMacro() const {
std::string expr;
if( m_info.macroName[0] == 0 )
- expr = m_info.capturedExpression;
+ expr = static_cast<std::string>(m_info.capturedExpression);
else {
expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );
expr += m_info.macroName;