From 78e5f1896014e1b521ddb4346d3e06bfa5bfdc53 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 20 May 2015 09:06:13 +0200 Subject: [PATCH] some more moving --- alib2data/src/exception/AlibException.cpp | 16 ++++++++-------- alib2data/src/exception/AlibException.h | 4 ++-- alib2data/test-src/tree/TreeTest.cpp | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/alib2data/src/exception/AlibException.cpp b/alib2data/src/exception/AlibException.cpp index 573c7a1efe..02a906365f 100644 --- a/alib2data/src/exception/AlibException.cpp +++ b/alib2data/src/exception/AlibException.cpp @@ -21,7 +21,7 @@ namespace exception { AlibException::AlibException ( ) { #ifdef DEBUG - this->backtrace = std::bfdStacktrace(); + //this->backtrace = std::bfdStacktrace(); #else this->backtrace = ""; #endif @@ -29,18 +29,18 @@ AlibException::AlibException ( ) { this->whatMessage += this->backtrace; } -AlibException::AlibException ( const std::string & cause ) : AlibException { } { - this->cause = cause; - +AlibException::AlibException ( std::string cause ) : AlibException { } { this->whatMessage += this->cause; -} -AlibException::AlibException ( const std::string & cause, const std::string& backtrace ) : AlibException { } { - this->backtrace = backtrace; - this->cause = cause; + this->cause = std::move(cause); +} +AlibException::AlibException ( std::string cause, std::string backtrace ) { this->whatMessage += this->backtrace; this->whatMessage += this->cause; + + this->backtrace = std::move(backtrace); + this->cause = std::move(cause); } AlibException::~AlibException ( ) noexcept { diff --git a/alib2data/src/exception/AlibException.h b/alib2data/src/exception/AlibException.h index 1b22e0cfaf..7b114b8225 100644 --- a/alib2data/src/exception/AlibException.h +++ b/alib2data/src/exception/AlibException.h @@ -28,9 +28,9 @@ protected: public: explicit AlibException ( ); - explicit AlibException ( const std::string & cause ); + explicit AlibException ( std::string cause ); - explicit AlibException ( const std::string & cause, const std::string& backtrace ); + explicit AlibException ( std::string cause, std::string backtrace ); virtual ~AlibException ( ) noexcept; diff --git a/alib2data/test-src/tree/TreeTest.cpp b/alib2data/test-src/tree/TreeTest.cpp index a8ad01f9e9..4003a5ceca 100644 --- a/alib2data/test-src/tree/TreeTest.cpp +++ b/alib2data/test-src/tree/TreeTest.cpp @@ -131,11 +131,11 @@ void TreeTest::testRankedTreeCompare() { } void TreeTest::testRankedTreeSymbolValidityCheck() { - alphabet::RankedSymbol a ('a', 2); - alphabet::RankedSymbol b ('b', 1); - alphabet::RankedSymbol c ('c', 0); - alphabet::RankedSymbol d ('d', 0); - alphabet::RankedSymbol e ('e', 0); + const alphabet::RankedSymbol a ('a', 2); + const alphabet::RankedSymbol b ('b', 1); + const alphabet::RankedSymbol c ('c', 0); + const alphabet::RankedSymbol d ('d', 0); + const alphabet::RankedSymbol e ('e', 0); const std::set<alphabet::RankedSymbol> alphabet {a, b, c, e}; @@ -298,11 +298,11 @@ void TreeTest::testUnrankedTreeCompare() { } void TreeTest::testUnrankedTreeSymbolValidityCheck() { - alphabet::LabeledSymbol a ('a'); - alphabet::LabeledSymbol b ('b'); - alphabet::LabeledSymbol c ('c'); - alphabet::LabeledSymbol d ('d'); - alphabet::LabeledSymbol e ('e'); + const alphabet::LabeledSymbol a ('a'); + const alphabet::LabeledSymbol b ('b'); + const alphabet::LabeledSymbol c ('c'); + const alphabet::LabeledSymbol d ('d'); + const alphabet::LabeledSymbol e ('e'); const std::set<alphabet::LabeledSymbol> alphabet {a, b, c, e}; -- GitLab