diff options
| author | Martin Hořeňovský | 2021-10-05 20:11:42 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-10-05 20:39:28 +0200 |
| commit | 4e6d306742cdaab773bf98277e30e77922bb8ee1 (patch) | |
| tree | 2769b78696408c68bf16d3782cfc535f07d2a118 /src/catch2/internal | |
| parent | c6c46a168f5213d2daa4eccd6d725ced11229c49 (diff) | |
| download | catch3-4e6d306742cdaab773bf98277e30e77922bb8ee1.tar.gz | |
Rename Catch::Option to Optional
Diffstat (limited to 'src/catch2/internal')
| -rw-r--r-- | src/catch2/internal/catch_optional.hpp (renamed from src/catch2/internal/catch_option.hpp) | 20 | ||||
| -rw-r--r-- | src/catch2/internal/catch_run_context.hpp | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/catch2/internal/catch_option.hpp b/src/catch2/internal/catch_optional.hpp index da335653..e2d7b057 100644 --- a/src/catch2/internal/catch_option.hpp +++ b/src/catch2/internal/catch_optional.hpp @@ -5,28 +5,28 @@ // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -#ifndef CATCH_OPTION_HPP_INCLUDED -#define CATCH_OPTION_HPP_INCLUDED +#ifndef CATCH_OPTIONAL_HPP_INCLUDED +#define CATCH_OPTIONAL_HPP_INCLUDED namespace Catch { // An optional type template<typename T> - class Option { + class Optional { public: - Option() : nullableValue( nullptr ) {} - Option( T const& _value ) + Optional() : nullableValue( nullptr ) {} + Optional( T const& _value ) : nullableValue( new( storage ) T( _value ) ) {} - Option( Option const& _other ) + Optional( Optional const& _other ) : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) {} - ~Option() { + ~Optional() { reset(); } - Option& operator= ( Option const& _other ) { + Optional& operator= ( Optional const& _other ) { if( &_other != this ) { reset(); if( _other ) @@ -34,7 +34,7 @@ namespace Catch { } return *this; } - Option& operator = ( T const& _value ) { + Optional& operator = ( T const& _value ) { reset(); nullableValue = new( storage ) T( _value ); return *this; @@ -82,4 +82,4 @@ namespace Catch { } // end namespace Catch -#endif // CATCH_OPTION_HPP_INCLUDED +#endif // CATCH_OPTIONAL_HPP_INCLUDED diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp index 7c315e9a..e0b64a04 100644 --- a/src/catch2/internal/catch_run_context.hpp +++ b/src/catch2/internal/catch_run_context.hpp @@ -17,7 +17,7 @@ #include <catch2/internal/catch_test_case_tracker.hpp> #include <catch2/catch_assertion_info.hpp> #include <catch2/catch_assertion_result.hpp> -#include <catch2/internal/catch_option.hpp> +#include <catch2/internal/catch_optional.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <string> @@ -126,7 +126,7 @@ namespace Catch { IMutableContext& m_context; TestCaseHandle const* m_activeTestCase = nullptr; ITracker* m_testCaseTracker = nullptr; - Option<AssertionResult> m_lastResult; + Optional<AssertionResult> m_lastResult; IConfig const* m_config; Totals m_totals; |