From b72077798dfd69e65a08e50af5d8c5d2dd507290 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 21 Apr 2015 23:41:48 +0200 Subject: [PATCH] add noexcept to move operator= / constructors --- alib2data/src/graph/common/Node.cpp | 2 +- alib2data/src/graph/common/Node.h | 2 +- alib2data/src/graph/directed/DirectedEdge.cpp | 2 +- alib2data/src/graph/directed/DirectedEdge.h | 2 +- .../src/graph/undirected/UndirectedEdge.cpp | 2 +- .../src/graph/undirected/UndirectedEdge.h | 2 +- .../regexp/formal/FormalRegExpAlternation.cpp | 2 +- .../regexp/formal/FormalRegExpAlternation.h | 18 +++++++++--------- .../formal/FormalRegExpConcatenation.cpp | 12 ++++++------ .../regexp/formal/FormalRegExpConcatenation.h | 18 +++++++++--------- .../src/regexp/formal/FormalRegExpElement.h | 6 +++--- .../src/regexp/formal/FormalRegExpEmpty.cpp | 14 +++++++------- .../src/regexp/formal/FormalRegExpEmpty.h | 10 +++++----- .../src/regexp/formal/FormalRegExpEpsilon.cpp | 14 +++++++------- .../src/regexp/formal/FormalRegExpEpsilon.h | 12 ++++++------ .../regexp/formal/FormalRegExpIteration.cpp | 4 ++-- .../src/regexp/formal/FormalRegExpIteration.h | 18 +++++++++--------- .../src/regexp/formal/FormalRegExpSymbol.cpp | 6 +++--- .../src/regexp/formal/FormalRegExpSymbol.h | 18 +++++++++--------- .../unbounded/UnboundedRegExpAlternation.cpp | 8 ++++---- .../unbounded/UnboundedRegExpAlternation.h | 2 +- .../unbounded/UnboundedRegExpConcatenation.cpp | 2 +- .../unbounded/UnboundedRegExpConcatenation.h | 14 +++++++------- .../regexp/unbounded/UnboundedRegExpElement.h | 8 ++++---- .../regexp/unbounded/UnboundedRegExpEmpty.cpp | 14 +++++++------- .../regexp/unbounded/UnboundedRegExpEmpty.h | 8 ++++---- .../unbounded/UnboundedRegExpEpsilon.cpp | 14 +++++++------- .../regexp/unbounded/UnboundedRegExpEpsilon.h | 8 ++++---- .../unbounded/UnboundedRegExpIteration.cpp | 4 ++-- .../unbounded/UnboundedRegExpIteration.h | 16 ++++++++-------- .../regexp/unbounded/UnboundedRegExpSymbol.cpp | 6 +++--- .../regexp/unbounded/UnboundedRegExpSymbol.h | 14 +++++++------- alib2data/src/std/variant.hpp | 6 +++--- 33 files changed, 144 insertions(+), 144 deletions(-) diff --git a/alib2data/src/graph/common/Node.cpp b/alib2data/src/graph/common/Node.cpp index c95656d79e..aad83a77b6 100644 --- a/alib2data/src/graph/common/Node.cpp +++ b/alib2data/src/graph/common/Node.cpp @@ -55,7 +55,7 @@ Node &Node::operator=(const Node &other) return *this; } -Node &Node::operator=(Node &&other) +Node &Node::operator=(Node &&other) noexcept { std::swap(name, other.name); return *this; diff --git a/alib2data/src/graph/common/Node.h b/alib2data/src/graph/common/Node.h index 3016a938fa..cc52dc5f47 100644 --- a/alib2data/src/graph/common/Node.h +++ b/alib2data/src/graph/common/Node.h @@ -20,7 +20,7 @@ public: Node(const Node &other); Node(Node &&other) noexcept; Node &operator=(const Node &other); - Node &operator=(Node &&other); + Node &operator=(Node &&other) noexcept; GraphElement *clone() const; GraphElement *plunder() &&; diff --git a/alib2data/src/graph/directed/DirectedEdge.cpp b/alib2data/src/graph/directed/DirectedEdge.cpp index a05cbce7b7..67eb6039ab 100644 --- a/alib2data/src/graph/directed/DirectedEdge.cpp +++ b/alib2data/src/graph/directed/DirectedEdge.cpp @@ -103,7 +103,7 @@ DirectedEdge &DirectedEdge::operator=(const DirectedEdge &other) return *this; } -DirectedEdge &DirectedEdge::operator=(DirectedEdge &&other) +DirectedEdge &DirectedEdge::operator=(DirectedEdge &&other) noexcept { std::swap(from, other.from); std::swap(to, other.to); diff --git a/alib2data/src/graph/directed/DirectedEdge.h b/alib2data/src/graph/directed/DirectedEdge.h index 75b1a34602..fecb0a71f7 100644 --- a/alib2data/src/graph/directed/DirectedEdge.h +++ b/alib2data/src/graph/directed/DirectedEdge.h @@ -25,7 +25,7 @@ public: DirectedEdge(const DirectedEdge &other); DirectedEdge(DirectedEdge &&other) noexcept; DirectedEdge &operator=(const DirectedEdge &other); - DirectedEdge &operator=(DirectedEdge &&other); + DirectedEdge &operator=(DirectedEdge &&other) noexcept; GraphElement *clone() const; GraphElement *plunder() &&; diff --git a/alib2data/src/graph/undirected/UndirectedEdge.cpp b/alib2data/src/graph/undirected/UndirectedEdge.cpp index 79327f8dd2..ac19853273 100644 --- a/alib2data/src/graph/undirected/UndirectedEdge.cpp +++ b/alib2data/src/graph/undirected/UndirectedEdge.cpp @@ -103,7 +103,7 @@ UndirectedEdge &UndirectedEdge::operator=(const UndirectedEdge &other) return *this; } -UndirectedEdge &UndirectedEdge::operator=(UndirectedEdge &&other) +UndirectedEdge &UndirectedEdge::operator=(UndirectedEdge &&other) noexcept { std::swap(first, other.first); std::swap(second, other.second); diff --git a/alib2data/src/graph/undirected/UndirectedEdge.h b/alib2data/src/graph/undirected/UndirectedEdge.h index b8c1b846ab..e0757e6327 100644 --- a/alib2data/src/graph/undirected/UndirectedEdge.h +++ b/alib2data/src/graph/undirected/UndirectedEdge.h @@ -25,7 +25,7 @@ public: UndirectedEdge(const UndirectedEdge &other); UndirectedEdge(UndirectedEdge &&other) noexcept; UndirectedEdge &operator=(const UndirectedEdge &other); - UndirectedEdge &operator=(UndirectedEdge &&other); + UndirectedEdge &operator=(UndirectedEdge &&other) noexcept; GraphElement *clone() const; GraphElement *plunder() &&; diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp b/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp index 622910ba0a..1a8b8588e3 100644 --- a/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp @@ -43,7 +43,7 @@ FormalRegExpAlternation& FormalRegExpAlternation::operator=(const FormalRegExpAl return *this; } -FormalRegExpAlternation& FormalRegExpAlternation::operator=(FormalRegExpAlternation&& other) { +FormalRegExpAlternation& FormalRegExpAlternation::operator=(FormalRegExpAlternation&& other) noexcept { std::swap(this->left, other.left); std::swap(this->right, other.right); diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.h b/alib2data/src/regexp/formal/FormalRegExpAlternation.h index d2a90b6ecb..2d6e1d20d5 100644 --- a/alib2data/src/regexp/formal/FormalRegExpAlternation.h +++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.h @@ -29,7 +29,7 @@ protected: * @copydoc FormalRegExpElement::clone() const */ virtual UnboundedRegExpElement* cloneAsUnbounded() const; - + FormalRegExpElement* left; FormalRegExpElement* right; @@ -37,32 +37,32 @@ protected: * @copydoc FormalRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc FormalRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const FormalRegExp * regexp ); - + /** * @copydoc FormalRegExpElement::computeMinimalAlphabet() */ virtual void computeMinimalAlphabet( std::set<alphabet::Symbol>& alphabet ) const; - + public: explicit FormalRegExpAlternation(FormalRegExpElement&& left, FormalRegExpElement&& right); explicit FormalRegExpAlternation(const FormalRegExpElement& left, const FormalRegExpElement& right); - + FormalRegExpAlternation(const FormalRegExpAlternation& other); FormalRegExpAlternation(FormalRegExpAlternation&& other) noexcept; FormalRegExpAlternation& operator =(const FormalRegExpAlternation& other); - FormalRegExpAlternation& operator =(FormalRegExpAlternation&& other); + FormalRegExpAlternation& operator =(FormalRegExpAlternation&& other) noexcept; virtual ~FormalRegExpAlternation() noexcept; /** * @copydoc FormalRegExpElement::clone() const */ virtual FormalRegExpElement* clone() const; - + /** * @copydoc FormalRegExpElement::plunder() const */ @@ -73,7 +73,7 @@ public: */ const FormalRegExpElement & getLeftElement() const; const FormalRegExpElement & getRightElement() const; - + /** * @return elements */ @@ -97,7 +97,7 @@ public: } virtual int compare(const FormalRegExpAlternation&) const; - + /** * @copydoc FormalRegExpElement::operator>>() const */ diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp index 9dee89ae1e..3776a3a094 100644 --- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp @@ -38,17 +38,17 @@ FormalRegExpConcatenation& FormalRegExpConcatenation::operator=(const FormalRegE } *this = FormalRegExpConcatenation(other); - + return *this; } -FormalRegExpConcatenation& FormalRegExpConcatenation::operator=(FormalRegExpConcatenation&& other) { +FormalRegExpConcatenation& FormalRegExpConcatenation::operator=(FormalRegExpConcatenation&& other) noexcept { std::swap(this->left, other.left); std::swap(this->right, other.right); this->left->attachRegExp(this->parentRegExp); this->right->attachRegExp(this->parentRegExp); - + return *this; } @@ -111,11 +111,11 @@ FormalRegExpElement* FormalRegExpConcatenation::clone() const { UnboundedRegExpElement* FormalRegExpConcatenation::cloneAsUnbounded() const { UnboundedRegExpConcatenation* res = new UnboundedRegExpConcatenation(); - + UnboundedRegExpElement* leftTmp = left->cloneAsUnbounded(); res->appendElement(std::move(*leftTmp)); delete leftTmp; - + UnboundedRegExpElement* rightTmp = right->cloneAsUnbounded(); res->appendElement(std::move(*rightTmp)); delete rightTmp; @@ -148,7 +148,7 @@ bool FormalRegExpConcatenation::testSymbol( const alphabet::Symbol & symbol ) co bool FormalRegExpConcatenation::attachRegExp(const FormalRegExp * regexp ) { if(this->parentRegExp == regexp) return true; - + this->parentRegExp = regexp; if(!left->attachRegExp(regexp)) return false; if(!right->attachRegExp(regexp)) return false; diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h index c64d9c9d88..16be1ad50c 100644 --- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h +++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h @@ -30,20 +30,20 @@ protected: * @copydoc FormalRegExpElement::clone() const */ virtual UnboundedRegExpElement* cloneAsUnbounded() const; - + FormalRegExpElement* left; FormalRegExpElement* right; - + /** * @copydoc FormalRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc FormalRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const FormalRegExp * regexp ); - + /** * @copydoc FormalRegExpElement::computeMinimalAlphabet() */ @@ -52,18 +52,18 @@ protected: public: explicit FormalRegExpConcatenation(FormalRegExpElement&& left, FormalRegExpElement&& right); explicit FormalRegExpConcatenation(const FormalRegExpElement& left, const FormalRegExpElement& right); - + FormalRegExpConcatenation(const FormalRegExpConcatenation& other); FormalRegExpConcatenation(FormalRegExpConcatenation&& other) noexcept; FormalRegExpConcatenation& operator =(const FormalRegExpConcatenation& other); - FormalRegExpConcatenation& operator =(FormalRegExpConcatenation&& other); + FormalRegExpConcatenation& operator =(FormalRegExpConcatenation&& other) noexcept; virtual ~FormalRegExpConcatenation() noexcept; - + /** * @copydoc FormalRegExpElement::clone() const */ virtual FormalRegExpElement* clone() const; - + /** * @copydoc FormalRegExpElement::plunder() const */ @@ -86,7 +86,7 @@ public: */ void setLeftElement(const FormalRegExpElement& element); void setLeftElement(FormalRegExpElement&& element); - + void setRightElement(const FormalRegExpElement& element); void setRightElement(FormalRegExpElement&& element); diff --git a/alib2data/src/regexp/formal/FormalRegExpElement.h b/alib2data/src/regexp/formal/FormalRegExpElement.h index 30ff34d1c4..4a1e923935 100644 --- a/alib2data/src/regexp/formal/FormalRegExpElement.h +++ b/alib2data/src/regexp/formal/FormalRegExpElement.h @@ -59,7 +59,7 @@ protected: * @return true if symbols used in regexp element are in the regexp's alphabet */ virtual bool attachRegExp ( const FormalRegExp * regexp ) = 0; - + /** * Traverses the regexp tree computing minimal alphabet needed by regexp * @@ -67,7 +67,7 @@ protected: * @return true if symbol is used by the element and its successor */ virtual void computeMinimalAlphabet( std::set<alphabet::Symbol>& alphabet ) const = 0; - + public: explicit FormalRegExpElement(); @@ -78,7 +78,7 @@ public: virtual UnboundedRegExpElement* cloneAsUnbounded() const = 0; friend class FormalRegExp; - + friend class FormalRegExpAlternation; friend class FormalRegExpConcatenation; friend class FormalRegExpIteration; diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp b/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp index e9762b674e..71b44316fd 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp @@ -11,25 +11,25 @@ namespace regexp { FormalRegExpEmpty::FormalRegExpEmpty() { - // so that default constructor is available + // so that default constructor is available } FormalRegExpEmpty::FormalRegExpEmpty(const FormalRegExpEmpty&) { - // so that copy constructor is available + // so that copy constructor is available } FormalRegExpEmpty::FormalRegExpEmpty(FormalRegExpEmpty&&) noexcept { - this->attachRegExp(NULL); + this->attachRegExp(NULL); } FormalRegExpEmpty& FormalRegExpEmpty::operator =(const FormalRegExpEmpty&) { - //this is actually different than default implementation - return *this; + // this is actually different than default implementation + return *this; } FormalRegExpEmpty& FormalRegExpEmpty::operator =(FormalRegExpEmpty&&) noexcept { - //this is actually different than default implementation - return *this; + // this is actually different than default implementation + return *this; } FormalRegExpElement* FormalRegExpEmpty::clone() const { diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.h b/alib2data/src/regexp/formal/FormalRegExpEmpty.h index 62d91438d7..617a9876b4 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEmpty.h +++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.h @@ -22,17 +22,17 @@ protected: * @copydoc FormalRegExpElement::clone() const */ virtual UnboundedRegExpElement* cloneAsUnbounded() const; - + /** * @copydoc FormalRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc FormalRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const FormalRegExp * regexp ); - + /** * @copydoc RegExpElement::computeMinimalAlphabet() */ @@ -49,7 +49,7 @@ public: * @copydoc FormalRegExpElement::clone() const */ virtual FormalRegExpElement* clone() const; - + /** * @copydoc FormalRegExpElement::plunder() const */ @@ -60,7 +60,7 @@ public: } virtual int compare(const FormalRegExpEmpty&) const; - + /** * @copydoc FormalRegExpElement::operator>>() const */ diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp b/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp index 63f85748df..7b55e73c9c 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp @@ -12,11 +12,11 @@ namespace regexp { FormalRegExpEpsilon::FormalRegExpEpsilon() { - // so that default constructor is available + // so that default constructor is available } FormalRegExpEpsilon::FormalRegExpEpsilon(const FormalRegExpEpsilon&) { - // so that copy constructor is available + // so that copy constructor is available } FormalRegExpEpsilon::FormalRegExpEpsilon(FormalRegExpEpsilon&&) noexcept { @@ -24,13 +24,13 @@ FormalRegExpEpsilon::FormalRegExpEpsilon(FormalRegExpEpsilon&&) noexcept { } FormalRegExpEpsilon& FormalRegExpEpsilon::operator =(const FormalRegExpEpsilon&) { - //this is actually different than default implementation - return *this; + // this is actually different than default implementation + return *this; } FormalRegExpEpsilon& FormalRegExpEpsilon::operator =(FormalRegExpEpsilon&&) noexcept { - //this is actually different than default implementation - return *this; + // this is actually different than default implementation + return *this; } FormalRegExpElement* FormalRegExpEpsilon::clone() const { @@ -46,7 +46,7 @@ UnboundedRegExpElement* FormalRegExpEpsilon::cloneAsUnbounded() const { } int FormalRegExpEpsilon::compare(const FormalRegExpEpsilon&) const { - return 0; + return 0; } void FormalRegExpEpsilon::operator>>(std::ostream& out) const { diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h index bc91013adc..a4beae2722 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h +++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h @@ -22,17 +22,17 @@ protected: * @copydoc FormalRegExpElement::clone() const */ virtual UnboundedRegExpElement* cloneAsUnbounded() const; - + /** * @copydoc FormalRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc FormalRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const FormalRegExp * regexp ); - + /** * @copydoc FormalRegExpElement::computeMinimalAlphabet() */ @@ -50,18 +50,18 @@ public: * @copydoc FormalRegExpElement::clone() const */ virtual FormalRegExpElement* clone() const; - + /** * @copydoc FormalRegExpElement::plunder() const */ virtual FormalRegExpElement* plunder() &&; - + virtual int compare(const FormalRegExpElement& other) const { return -other.compare(*this); } virtual int compare(const FormalRegExpEpsilon&) const; - + /** * @copydoc FormalRegExpElement::operator>>() const */ diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.cpp b/alib2data/src/regexp/formal/FormalRegExpIteration.cpp index 1eef7c4858..a769b4fd15 100644 --- a/alib2data/src/regexp/formal/FormalRegExpIteration.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpIteration.cpp @@ -41,10 +41,10 @@ FormalRegExpIteration& FormalRegExpIteration::operator=(const FormalRegExpIterat return *this; } -FormalRegExpIteration& FormalRegExpIteration::operator=(FormalRegExpIteration&& other) { +FormalRegExpIteration& FormalRegExpIteration::operator=(FormalRegExpIteration&& other) noexcept { std::swap(this->element, other.element); std::swap(this->parentRegExp, other.parentRegExp); - + this->attachRegExp(other.parentRegExp); return *this; diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.h b/alib2data/src/regexp/formal/FormalRegExpIteration.h index 6a1e1d42f6..25ff175a7b 100644 --- a/alib2data/src/regexp/formal/FormalRegExpIteration.h +++ b/alib2data/src/regexp/formal/FormalRegExpIteration.h @@ -31,7 +31,7 @@ protected: * @copydoc FormalRegExpElement::clone() const */ virtual UnboundedRegExpElement* cloneAsUnbounded() const; - + /** * @copydoc FormalRegExpElement::testSymbol() const */ @@ -41,27 +41,27 @@ protected: * @copydoc FormalRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const FormalRegExp * regexp ); - + /** * @copydoc FormalRegExpElement::computeMinimalAlphabet() */ virtual void computeMinimalAlphabet( std::set<alphabet::Symbol>& alphabet ) const; - + public: explicit FormalRegExpIteration(FormalRegExpElement&&); explicit FormalRegExpIteration(const FormalRegExpElement&); - + FormalRegExpIteration(const FormalRegExpIteration& other); FormalRegExpIteration(FormalRegExpIteration&& other) noexcept; FormalRegExpIteration& operator =(const FormalRegExpIteration& other); - FormalRegExpIteration& operator =(FormalRegExpIteration&& other); + FormalRegExpIteration& operator =(FormalRegExpIteration&& other) noexcept; virtual ~FormalRegExpIteration() noexcept; /** * @copydoc FormalRegExpElement::clone() const */ virtual FormalRegExpElement* clone() const; - + /** * @copydoc FormalRegExpElement::plunder() const */ @@ -72,17 +72,17 @@ public: * @return element */ const FormalRegExpElement & getElement() const; - + /** * @return element */ FormalRegExpElement & getElement(); - + /** * @param element to iterate */ void setElement(const FormalRegExpElement& element); - + void setElement(FormalRegExpElement&& element); virtual int compare(const FormalRegExpElement& other) const { diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp b/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp index e2c1b55474..fb3df17af3 100644 --- a/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp +++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp @@ -41,12 +41,12 @@ FormalRegExpSymbol& FormalRegExpSymbol::operator=(const FormalRegExpSymbol& othe return *this; } -FormalRegExpSymbol& FormalRegExpSymbol::operator=(FormalRegExpSymbol&& other) { +FormalRegExpSymbol& FormalRegExpSymbol::operator=(FormalRegExpSymbol&& other) noexcept { std::swap(this->symbol, other.symbol); std::swap(this->parentRegExp, other.parentRegExp); - + this->attachRegExp(other.parentRegExp); - + return *this; } diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.h b/alib2data/src/regexp/formal/FormalRegExpSymbol.h index 3a7cd16d79..bfab54dde6 100644 --- a/alib2data/src/regexp/formal/FormalRegExpSymbol.h +++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.h @@ -25,17 +25,17 @@ protected: * @copydoc FormalRegExpElement::clone() const */ virtual UnboundedRegExpElement* cloneAsUnbounded() const; - + /** * @copydoc FormalRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc FormalRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const FormalRegExp * regexp ); - + /** * @copydoc FormalRegExpElement::computeMinimalAlphabet() */ @@ -47,23 +47,23 @@ public: explicit FormalRegExpSymbol(const alphabet::Symbol& symbol); explicit FormalRegExpSymbol(alphabet::Symbol&& symbol); - + FormalRegExpSymbol(const FormalRegExpSymbol& other); FormalRegExpSymbol(FormalRegExpSymbol&& other) noexcept; FormalRegExpSymbol& operator=(const FormalRegExpSymbol& other); - FormalRegExpSymbol& operator=(FormalRegExpSymbol&& other); + FormalRegExpSymbol& operator=(FormalRegExpSymbol&& other) noexcept; /** * @copydoc FormalRegExpElement::clone() const */ virtual FormalRegExpElement* clone() const; - + /** * @copydoc FormalRegExpElement::plunder() const */ virtual FormalRegExpElement* plunder() &&; - + bool operator==(const alphabet::Symbol&) const; friend bool operator==(const alphabet::Symbol&, const FormalRegExpSymbol&); @@ -72,12 +72,12 @@ public: } virtual int compare(const FormalRegExpSymbol&) const; - + /** * @copydoc FormalRegExpElement::operator>>() const */ virtual void operator>>(std::ostream& out) const; - + /** * Returns the string representation of RegExp Symbol. */ diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp index 1df63332c4..2f418d4bcf 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp @@ -38,12 +38,12 @@ UnboundedRegExpAlternation& UnboundedRegExpAlternation::operator=(const Unbounde return *this; } -UnboundedRegExpAlternation& UnboundedRegExpAlternation::operator=(UnboundedRegExpAlternation&& other) { +UnboundedRegExpAlternation& UnboundedRegExpAlternation::operator=(UnboundedRegExpAlternation&& other) noexcept { std::swap(this->elements, other.elements); std::swap(this->parentRegExp, other.parentRegExp); // this->parentRegExp is stored within othes.parentRegExp and it is reattached on the next line - + this->attachRegExp(other.parentRegExp); - + return *this; } @@ -139,7 +139,7 @@ bool UnboundedRegExpAlternation::testSymbol( const alphabet::Symbol & symbol ) c bool UnboundedRegExpAlternation::attachRegExp(const UnboundedRegExp * regexp ) { if(this->parentRegExp == regexp) return true; - + this->parentRegExp = regexp; for(const auto& child : this->elements) if(!child->attachRegExp(regexp)) return false; diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h index c250ab5247..1e01e6c0f1 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h @@ -53,7 +53,7 @@ public: UnboundedRegExpAlternation(const UnboundedRegExpAlternation& other); UnboundedRegExpAlternation(UnboundedRegExpAlternation&& other) noexcept; UnboundedRegExpAlternation& operator =(const UnboundedRegExpAlternation& other); - UnboundedRegExpAlternation& operator =(UnboundedRegExpAlternation&& other); + UnboundedRegExpAlternation& operator =(UnboundedRegExpAlternation&& other) noexcept; virtual ~UnboundedRegExpAlternation() noexcept; /** diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp index 334d1c1e8d..b12581b6b4 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp @@ -37,7 +37,7 @@ UnboundedRegExpConcatenation& UnboundedRegExpConcatenation::operator=(const Unbo return *this; } -UnboundedRegExpConcatenation& UnboundedRegExpConcatenation::operator=(UnboundedRegExpConcatenation&& other) { +UnboundedRegExpConcatenation& UnboundedRegExpConcatenation::operator=(UnboundedRegExpConcatenation&& other) noexcept { std::swap(this->elements, other.elements); std::swap(this->parentRegExp, other.parentRegExp); // this->parentRegExp is stored within othes.parentRegExp and it is reattached on the next line diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h index b3b7031ad2..957bc2fa23 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h @@ -32,17 +32,17 @@ protected: std::vector<UnboundedRegExpElement*> elements; - + /** * @copydoc UnboundedRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc UnboundedRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const UnboundedRegExp * regexp ); - + /** * @copydoc UnboundedRegExpElement::computeMinimalAlphabet() */ @@ -50,11 +50,11 @@ protected: public: explicit UnboundedRegExpConcatenation(); - + UnboundedRegExpConcatenation(const UnboundedRegExpConcatenation& other); UnboundedRegExpConcatenation(UnboundedRegExpConcatenation&& other) noexcept; UnboundedRegExpConcatenation& operator =(const UnboundedRegExpConcatenation& other); - UnboundedRegExpConcatenation& operator =(UnboundedRegExpConcatenation&& other); + UnboundedRegExpConcatenation& operator =(UnboundedRegExpConcatenation&& other) noexcept; virtual ~UnboundedRegExpConcatenation() noexcept; /** @@ -67,7 +67,7 @@ public: */ virtual UnboundedRegExpElement* plunder() &&; - + /** * @return elements */ @@ -82,7 +82,7 @@ public: * @param element to append */ void appendElement(const UnboundedRegExpElement& element); - + void appendElement(UnboundedRegExpElement&& element); virtual int compare(const UnboundedRegExpElement& other) const { diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h b/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h index b057c8d0a2..684a2e35bd 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h @@ -59,7 +59,7 @@ protected: * @return true if symbols used in regexp element are in the regexp's alphabet */ virtual bool attachRegExp ( const UnboundedRegExp * regexp ) = 0; - + /** * Traverses the regexp tree computing minimal alphabet needed by regexp * @@ -67,10 +67,10 @@ protected: * @return true if symbol is used by the element and its successor */ virtual void computeMinimalAlphabet( std::set<alphabet::Symbol>& alphabet ) const = 0; - + public: explicit UnboundedRegExpElement(); - + /** * Creates copy of the element. * @return copy of the element @@ -78,7 +78,7 @@ public: virtual FormalRegExpElement* cloneAsFormal() const = 0; friend class UnboundedRegExp; - + friend class UnboundedRegExpAlternation; friend class UnboundedRegExpConcatenation; friend class UnboundedRegExpIteration; diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp index ca5c670c85..dee5c501cd 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp @@ -12,25 +12,25 @@ namespace regexp { UnboundedRegExpEmpty::UnboundedRegExpEmpty() { - // so that default constructor is available + // so that default constructor is available } UnboundedRegExpEmpty::UnboundedRegExpEmpty(const UnboundedRegExpEmpty&) { - // so that copy constructor is available + // so that copy constructor is available } UnboundedRegExpEmpty::UnboundedRegExpEmpty(UnboundedRegExpEmpty&&) noexcept { - this->attachRegExp(NULL); + this->attachRegExp(NULL); } UnboundedRegExpEmpty& UnboundedRegExpEmpty::operator =(const UnboundedRegExpEmpty&) { - //this is actually different than default implementation - return *this; + // this is actually different than default implementation + return *this; } UnboundedRegExpEmpty& UnboundedRegExpEmpty::operator =(UnboundedRegExpEmpty&&) noexcept { - //this is actually different than default implementation - return *this; + // this is actually different than default implementation + return *this; } UnboundedRegExpElement* UnboundedRegExpEmpty::clone() const { diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h index eee6cccbe1..37135c3ce5 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h @@ -26,12 +26,12 @@ protected: * @copydoc UnboundedRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc UnboundedRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const UnboundedRegExp * regexp ); - + /** * @copydoc RegExpElement::computeMinimalAlphabet() */ @@ -48,7 +48,7 @@ public: * @copydoc UnboundedRegExpElement::clone() const */ virtual UnboundedRegExpElement* clone() const; - + /** * @copydoc UnboundedRegExpElement::plunder() const */ @@ -59,7 +59,7 @@ public: } virtual int compare(const UnboundedRegExpEmpty&) const; - + /** * @copydoc UnboundedRegExpElement::operator>>() const */ diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp index 964d1dd1d9..0ecd629c8c 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp @@ -12,11 +12,11 @@ namespace regexp { UnboundedRegExpEpsilon::UnboundedRegExpEpsilon() { - // so that default constructor is available + // so that default constructor is available } UnboundedRegExpEpsilon::UnboundedRegExpEpsilon(const UnboundedRegExpEpsilon&) { - // so that copy constructor is available + // so that copy constructor is available } UnboundedRegExpEpsilon::UnboundedRegExpEpsilon(UnboundedRegExpEpsilon&&) noexcept { @@ -24,13 +24,13 @@ UnboundedRegExpEpsilon::UnboundedRegExpEpsilon(UnboundedRegExpEpsilon&&) noexcep } UnboundedRegExpEpsilon& UnboundedRegExpEpsilon::operator =(const UnboundedRegExpEpsilon&) { - //this is actually different than default implementation - return *this; + // this is actually different than default implementation + return *this; } UnboundedRegExpEpsilon& UnboundedRegExpEpsilon::operator =(UnboundedRegExpEpsilon&&) noexcept { - //this is actually different than default implementation - return *this; + // this is actually different than default implementation + return *this; } UnboundedRegExpElement* UnboundedRegExpEpsilon::clone() const { @@ -46,7 +46,7 @@ FormalRegExpElement* UnboundedRegExpEpsilon::cloneAsFormal() const { } int UnboundedRegExpEpsilon::compare(const UnboundedRegExpEpsilon&) const { - return 0; + return 0; } void UnboundedRegExpEpsilon::operator>>(std::ostream& out) const { diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h index fe478f502e..66e8501fff 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h @@ -26,12 +26,12 @@ protected: * @copydoc UnboundedRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc UnboundedRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const UnboundedRegExp * regexp ); - + /** * @copydoc UnboundedRegExpElement::computeMinimalAlphabet() */ @@ -49,7 +49,7 @@ public: * @copydoc UnboundedRegExpElement::clone() const */ virtual UnboundedRegExpElement* clone() const; - + /** * @copydoc UnboundedRegExpElement::plunder() const */ @@ -60,7 +60,7 @@ public: } virtual int compare(const UnboundedRegExpEpsilon&) const; - + /** * @copydoc UnboundedRegExpElement::operator>>() const */ diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp index 2b139cabb6..02a185416e 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp @@ -41,10 +41,10 @@ UnboundedRegExpIteration& UnboundedRegExpIteration::operator=(const UnboundedReg return *this; } -UnboundedRegExpIteration& UnboundedRegExpIteration::operator=(UnboundedRegExpIteration&& other) { +UnboundedRegExpIteration& UnboundedRegExpIteration::operator=(UnboundedRegExpIteration&& other) noexcept { std::swap(this->element, other.element); std::swap(this->parentRegExp, other.parentRegExp); - + this->attachRegExp(other.parentRegExp); return *this; diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h index 3fd2cff712..f24f90720b 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h @@ -41,27 +41,27 @@ protected: * @copydoc UnboundedRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const UnboundedRegExp * regexp ); - + /** * @copydoc UnboundedRegExpElement::computeMinimalAlphabet() */ virtual void computeMinimalAlphabet( std::set<alphabet::Symbol>& alphabet ) const; - + public: explicit UnboundedRegExpIteration(UnboundedRegExpElement&&); explicit UnboundedRegExpIteration(const UnboundedRegExpElement&); - + UnboundedRegExpIteration(const UnboundedRegExpIteration& other); UnboundedRegExpIteration(UnboundedRegExpIteration&& other) noexcept; UnboundedRegExpIteration& operator =(const UnboundedRegExpIteration& other); - UnboundedRegExpIteration& operator =(UnboundedRegExpIteration&& other); + UnboundedRegExpIteration& operator =(UnboundedRegExpIteration&& other) noexcept; virtual ~UnboundedRegExpIteration() noexcept; /** * @copydoc UnboundedRegExpElement::clone() const */ virtual UnboundedRegExpElement* clone() const; - + /** * @copydoc UnboundedRegExpElement::plunder() const */ @@ -71,17 +71,17 @@ public: * @return element */ const UnboundedRegExpElement & getElement() const; - + /** * @return element */ UnboundedRegExpElement & getElement(); - + /** * @param element to iterate */ void setElement(const UnboundedRegExpElement& element); - + void setElement(UnboundedRegExpElement&& element); virtual int compare(const UnboundedRegExpElement& other) const { diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp index 47e5e49ad0..8145ffbfcb 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp @@ -41,12 +41,12 @@ UnboundedRegExpSymbol& UnboundedRegExpSymbol::operator=(const UnboundedRegExpSym return *this; } -UnboundedRegExpSymbol& UnboundedRegExpSymbol::operator=(UnboundedRegExpSymbol&& other) { +UnboundedRegExpSymbol& UnboundedRegExpSymbol::operator=(UnboundedRegExpSymbol&& other) noexcept { std::swap(this->symbol, other.symbol); std::swap(this->parentRegExp, other.parentRegExp); - + this->attachRegExp(other.parentRegExp); - + return *this; } diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h index e5bb25efde..8328d789ac 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h @@ -30,12 +30,12 @@ protected: * @copydoc UnboundedRegExpElement::testSymbol() const */ virtual bool testSymbol( const alphabet::Symbol & symbol ) const; - + /** * @copydoc UnboundedRegExpElement::attachRegExp() */ virtual bool attachRegExp ( const UnboundedRegExp * regexp ); - + /** * @copydoc UnboundedRegExpElement::computeMinimalAlphabet() */ @@ -47,17 +47,17 @@ public: explicit UnboundedRegExpSymbol(const alphabet::Symbol& symbol); explicit UnboundedRegExpSymbol(alphabet::Symbol&& symbol); - + UnboundedRegExpSymbol(const UnboundedRegExpSymbol& other); UnboundedRegExpSymbol(UnboundedRegExpSymbol&& other) noexcept; UnboundedRegExpSymbol& operator=(const UnboundedRegExpSymbol& other); - UnboundedRegExpSymbol& operator=(UnboundedRegExpSymbol&& other); + UnboundedRegExpSymbol& operator=(UnboundedRegExpSymbol&& other) noexcept; /** * @copydoc UnboundedRegExpElement::clone() const */ virtual UnboundedRegExpElement* clone() const; - + /** * @copydoc UnboundedRegExpElement::plunder() const */ @@ -71,12 +71,12 @@ public: } virtual int compare(const UnboundedRegExpSymbol&) const; - + /** * @copydoc UnboundedRegExpElement::operator>>() const */ virtual void operator>>(std::ostream& out) const; - + /** * Returns the string representation of RegExp Symbol. */ diff --git a/alib2data/src/std/variant.hpp b/alib2data/src/std/variant.hpp index 7ffc722063..22352c0477 100644 --- a/alib2data/src/std/variant.hpp +++ b/alib2data/src/std/variant.hpp @@ -141,14 +141,14 @@ public: } //move constructor - variant(variant<Ts...>&& old) : variant_base<static_max<sizeof(Ts)...>, static_max<alignof(Ts)...>, Ts...>() + variant(variant<Ts...>&& old) noexcept : variant_base<static_max<sizeof(Ts)...>, static_max<alignof(Ts)...>, Ts...>() { this->type_id = old.type_id; helper_t::move(old.type_id, &old.data, &this->data); } //assignment operator - variant<Ts...>& operator= (variant<Ts...> old) + variant<Ts...>& operator= (variant<Ts...> old) noexcept { std::swap(this->type_id, old.type_id); std::swap(this->data, old.data); @@ -239,7 +239,7 @@ public: throw std::bad_cast(); } - ~variant() { + ~variant() noexcept { helper_t::destroy(this->type_id, &this->data); } -- GitLab