summaryrefslogtreecommitdiff
path: root/src/pugixml.hpp
diff options
context:
space:
mode:
authorMatthäus Brandl <brandl.matthaeus@gmail.com>2018-03-02 05:13:43 +0100
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2018-03-01 20:13:43 -0800
commit8284dbf61d85d82d17060dc34528d07a92829b40 (patch)
treecc74eee65cc19a8a3a35b0735b0142eb557edf20 /src/pugixml.hpp
parent41219a5a207a25ff16f661fae280523084c12dc3 (diff)
Add noexcept specifiers to move special members where possible (#183)
* Adds a macro definition to be able to use noexcept with supporting compilers * Adds noexcept specifier to move special members of xpath_node_set, xpath_variable_set and xpath_query, but not of xml_document as it has a throwing implementation
Diffstat (limited to 'src/pugixml.hpp')
-rw-r--r--src/pugixml.hpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index 9277384..a0dd0e4 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -81,6 +81,20 @@
# endif
#endif
+// If C++ is 2011 or higher, add 'noexcept' specifiers
+#ifndef PUGIXML_HAS_NOEXCEPT
+# if __cplusplus >= 201103
+# define PUGIXML_HAS_NOEXCEPT
+# elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
+# define PUGIXML_HAS_NOEXCEPT
+# endif
+#endif
+#ifdef PUGIXML_HAS_NOEXCEPT
+# define PUGIXML_NOEXCEPT noexcept
+#else
+# define PUGIXML_NOEXCEPT
+#endif
+
// If C++ is 2011 or higher, add 'override' qualifiers
#ifndef PUGIXML_OVERRIDE
# if __cplusplus >= 201103
@@ -1140,8 +1154,8 @@ namespace pugi
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
- xpath_variable_set(xpath_variable_set&& rhs);
- xpath_variable_set& operator=(xpath_variable_set&& rhs);
+ xpath_variable_set(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
+ xpath_variable_set& operator=(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
#endif
// Add a new variable or get the existing one, if the types match
@@ -1184,8 +1198,8 @@ namespace pugi
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
- xpath_query(xpath_query&& rhs);
- xpath_query& operator=(xpath_query&& rhs);
+ xpath_query(xpath_query&& rhs) PUGIXML_NOEXCEPT;
+ xpath_query& operator=(xpath_query&& rhs) PUGIXML_NOEXCEPT;
#endif
// Get query expression return type
@@ -1325,8 +1339,8 @@ namespace pugi
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
- xpath_node_set(xpath_node_set&& rhs);
- xpath_node_set& operator=(xpath_node_set&& rhs);
+ xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
+ xpath_node_set& operator=(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
#endif
// Get collection type
@@ -1360,7 +1374,7 @@ namespace pugi
xpath_node* _end;
void _assign(const_iterator begin, const_iterator end, type_t type);
- void _move(xpath_node_set& rhs);
+ void _move(xpath_node_set& rhs) PUGIXML_NOEXCEPT;
};
#endif