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
Avoid copying SectionInfo while construction Section
- Commit
c5037743e6834c3abcf942cb02a29c6119ecc699- Author
- Martin Hořeňovský ·
- Parents
9d6ac62affc0
Changes
src/catch2/internal/catch_section.cpp | 10 ++++++---- src/catch2/internal/catch_section.hpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/catch2/internal/catch_section.cpp b/src/catch2/internal/catch_section.cpp index 52361584..9db6ca9f 100644 --- a/src/catch2/internal/catch_section.cpp +++ b/src/catch2/internal/catch_section.cpp @@ -10,12 +10,14 @@ #include <catch2/internal/catch_test_macro_impl.hpp> #include <catch2/internal/catch_uncaught_exceptions.hpp> +#include <utility> + namespace Catch { - Section::Section( SectionInfo const& info ) - : m_info( info ), - m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) - { + Section::Section( SectionInfo&& info ): + m_info( std::move( info ) ), + m_sectionIncluded( + getResultCapture().sectionStarted( m_info, m_assertions ) ) { // Non-"included" sections will not use the timing information // anyway, so don't bother with the potential syscall. if (m_sectionIncluded) { diff --git a/src/catch2/internal/catch_section.hpp b/src/catch2/internal/catch_section.hpp index 997e7069..bdaf54af 100644 --- a/src/catch2/internal/catch_section.hpp +++ b/src/catch2/internal/catch_section.hpp @@ -19,7 +19,7 @@ namespace Catch { class Section : NonCopyable { public: - Section( SectionInfo const& info ); + Section( SectionInfo&& info ); ~Section(); // This indicates whether the section should be executed or not