diff --git a/alib2data/src/exception/AlibException.cpp b/alib2data/src/exception/AlibException.cpp index 573c7a1efeef581747e6c58bf9a00e9bf946c02d..02a906365ffcf8eb5db305836c7aa87aad184790 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 1b22e0cfaf938fbd4e10d3dee5349f132f3aaf9b..7b114b822539148865f2f1277862cbf3ea64027d 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 a8ad01f9e9a2e5f09c0eb400c1258d22243112d4..4003a5ceca3dda9893f5c0f16b3f71190fc62a3f 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};