catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Move strings in Clara's result type
- Commit
e539e1cb52006074b4f6bf0887d2f52799abb1af- Author
- Martin Hořeňovský ·
- Parents
3c5c86a4e417
Changes
src/catch2/internal/catch_clara.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/catch2/internal/catch_clara.hpp b/src/catch2/internal/catch_clara.hpp index 8de9a72e..00761c0a 100644 --- a/src/catch2/internal/catch_clara.hpp +++ b/src/catch2/internal/catch_clara.hpp @@ -224,13 +224,13 @@ namespace Catch { return { ResultType::Ok, value }; } static auto ok() -> BasicResult { return { ResultType::Ok }; } - static auto logicError( std::string const& message ) + static auto logicError( std::string&& message ) -> BasicResult { - return { ResultType::LogicError, message }; + return { ResultType::LogicError, CATCH_MOVE(message) }; } - static auto runtimeError( std::string const& message ) + static auto runtimeError( std::string&& message ) -> BasicResult { - return { ResultType::RuntimeError, message }; + return { ResultType::RuntimeError, CATCH_MOVE(message) }; } explicit operator bool() const { @@ -256,8 +256,8 @@ namespace Catch { m_errorMessage; // Only populated if resultType is an error BasicResult( ResultType type, - std::string const& message ): - ResultValueBase<T>( type ), m_errorMessage( message ) { + std::string&& message ): + ResultValueBase<T>( type ), m_errorMessage( CATCH_MOVE(message) ) { assert( m_type != ResultType::Ok ); }