Avoid copying SectionInfo while construction Section

This commit is contained in:
Martin Hořeňovský 2020-07-29 21:29:38 +02:00
parent 9d6ac62aff
commit c5037743e6
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 7 additions and 5 deletions

View File

@ -10,12 +10,14 @@
#include <catch2/internal/catch_test_macro_impl.hpp> #include <catch2/internal/catch_test_macro_impl.hpp>
#include <catch2/internal/catch_uncaught_exceptions.hpp> #include <catch2/internal/catch_uncaught_exceptions.hpp>
#include <utility>
namespace Catch { namespace Catch {
Section::Section( SectionInfo const& info ) Section::Section( SectionInfo&& info ):
: m_info( info ), m_info( std::move( info ) ),
m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) m_sectionIncluded(
{ getResultCapture().sectionStarted( m_info, m_assertions ) ) {
// Non-"included" sections will not use the timing information // Non-"included" sections will not use the timing information
// anyway, so don't bother with the potential syscall. // anyway, so don't bother with the potential syscall.
if (m_sectionIncluded) { if (m_sectionIncluded) {

View File

@ -19,7 +19,7 @@ namespace Catch {
class Section : NonCopyable { class Section : NonCopyable {
public: public:
Section( SectionInfo const& info ); Section( SectionInfo&& info );
~Section(); ~Section();
// This indicates whether the section should be executed or not // This indicates whether the section should be executed or not