From 9187e6500c0a5fe5fedcc5444c234bfcb8a61a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20Brandl?= Date: Sat, 3 Mar 2018 19:19:37 +0100 Subject: =?UTF-8?q?Adds=20noexcept=20specifiers=20to=20the=20move=20specia?= =?UTF-8?q?l=20members=20of=20xml=5Fdocument,=E2=80=A6=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds noexcept specifiers to the move special members of xml_document, but only #ifndef PUGIXML_COMPACT --- src/pugixml.cpp | 6 +++--- src/pugixml.hpp | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 6f6aac8..9e6fe48 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -6838,13 +6838,13 @@ namespace pugi } #ifdef PUGIXML_HAS_MOVE - PUGI__FN xml_document::xml_document(xml_document&& rhs): _buffer(0) + PUGI__FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(0) { _create(); _move(rhs); } - PUGI__FN xml_document& xml_document::operator=(xml_document&& rhs) + PUGI__FN xml_document& xml_document::operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT { if (this == &rhs) return *this; @@ -6952,7 +6952,7 @@ namespace pugi } #ifdef PUGIXML_HAS_MOVE - PUGI__FN void xml_document::_move(xml_document& rhs) + PUGI__FN void xml_document::_move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT { impl::xml_document_struct* doc = static_cast(_root); impl::xml_document_struct* other = static_cast(rhs._root); diff --git a/src/pugixml.hpp b/src/pugixml.hpp index a0dd0e4..dc887a9 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -91,8 +91,14 @@ #endif #ifdef PUGIXML_HAS_NOEXCEPT # define PUGIXML_NOEXCEPT noexcept +# ifdef PUGIXML_COMPACT +# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT +# else +# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT noexcept +# endif #else # define PUGIXML_NOEXCEPT +# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT #endif // If C++ is 2011 or higher, add 'override' qualifiers @@ -999,7 +1005,7 @@ namespace pugi void _create(); void _destroy(); - void _move(xml_document& rhs); + void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT; public: // Default constructor, makes empty document @@ -1010,8 +1016,8 @@ namespace pugi #ifdef PUGIXML_HAS_MOVE // Move semantics support - xml_document(xml_document&& rhs); - xml_document& operator=(xml_document&& rhs); + xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT; + xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT; #endif // Removes all nodes, leaving the empty document -- cgit v1.2.3