Adds noexcept specifiers to the move special members of xml_document,… (#185)

* Adds noexcept specifiers to the move special members of xml_document, but only #ifndef PUGIXML_COMPACT
This commit is contained in:
Matthäus Brandl 2018-03-03 19:19:37 +01:00 committed by Arseny Kapoulkine
parent 8284dbf61d
commit 9187e6500c
2 changed files with 12 additions and 6 deletions

View File

@ -6838,13 +6838,13 @@ namespace pugi
} }
#ifdef PUGIXML_HAS_MOVE #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(); _create();
_move(rhs); _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; if (this == &rhs) return *this;
@ -6952,7 +6952,7 @@ namespace pugi
} }
#ifdef PUGIXML_HAS_MOVE #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<impl::xml_document_struct*>(_root); impl::xml_document_struct* doc = static_cast<impl::xml_document_struct*>(_root);
impl::xml_document_struct* other = static_cast<impl::xml_document_struct*>(rhs._root); impl::xml_document_struct* other = static_cast<impl::xml_document_struct*>(rhs._root);

View File

@ -91,8 +91,14 @@
#endif #endif
#ifdef PUGIXML_HAS_NOEXCEPT #ifdef PUGIXML_HAS_NOEXCEPT
# define PUGIXML_NOEXCEPT noexcept # define PUGIXML_NOEXCEPT noexcept
# ifdef PUGIXML_COMPACT
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
# else
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT noexcept
# endif
#else #else
# define PUGIXML_NOEXCEPT # define PUGIXML_NOEXCEPT
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
#endif #endif
// If C++ is 2011 or higher, add 'override' qualifiers // If C++ is 2011 or higher, add 'override' qualifiers
@ -999,7 +1005,7 @@ namespace pugi
void _create(); void _create();
void _destroy(); void _destroy();
void _move(xml_document& rhs); void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
public: public:
// Default constructor, makes empty document // Default constructor, makes empty document
@ -1010,8 +1016,8 @@ namespace pugi
#ifdef PUGIXML_HAS_MOVE #ifdef PUGIXML_HAS_MOVE
// Move semantics support // Move semantics support
xml_document(xml_document&& rhs); xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
xml_document& operator=(xml_document&& rhs); xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
#endif #endif
// Removes all nodes, leaving the empty document // Removes all nodes, leaving the empty document