diff options
| author | Martin Hořeňovský | 2020-07-29 21:29:38 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-07-29 21:51:10 +0200 |
| commit | c5037743e6834c3abcf942cb02a29c6119ecc699 (patch) | |
| tree | 274f7ae5d68296e4271f17433e4ecd9baee33da8 /src/catch2/internal | |
| parent | 9d6ac62affc0ea775438636351929ab8521ddc26 (diff) | |
| download | catch3-c5037743e6834c3abcf942cb02a29c6119ecc699.tar.gz | |
Avoid copying SectionInfo while construction Section
Diffstat (limited to 'src/catch2/internal')
| -rw-r--r-- | src/catch2/internal/catch_section.cpp | 10 | ||||
| -rw-r--r-- | 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 |