Refactor move semantics support detection
Do it in one place and set PUGIXML_HAS_MOVE if it's available.
This commit is contained in:
parent
b3fc28d177
commit
aa117cce42
@ -11923,7 +11923,7 @@ namespace pugi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
PUGI__FN void xpath_node_set::_move(xpath_node_set& rhs)
|
PUGI__FN void xpath_node_set::_move(xpath_node_set& rhs)
|
||||||
{
|
{
|
||||||
_type = rhs._type;
|
_type = rhs._type;
|
||||||
@ -11966,7 +11966,7 @@ namespace pugi
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
PUGI__FN xpath_node_set::xpath_node_set(xpath_node_set&& rhs): _type(type_unsorted), _begin(&_storage), _end(&_storage)
|
PUGI__FN xpath_node_set::xpath_node_set(xpath_node_set&& rhs): _type(type_unsorted), _begin(&_storage), _end(&_storage)
|
||||||
{
|
{
|
||||||
_move(rhs);
|
_move(rhs);
|
||||||
@ -12166,7 +12166,7 @@ namespace pugi
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
PUGI__FN xpath_variable_set::xpath_variable_set(xpath_variable_set&& rhs)
|
PUGI__FN xpath_variable_set::xpath_variable_set(xpath_variable_set&& rhs)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
|
for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
|
||||||
@ -12360,7 +12360,7 @@ namespace pugi
|
|||||||
impl::xpath_query_impl::destroy(static_cast<impl::xpath_query_impl*>(_impl));
|
impl::xpath_query_impl::destroy(static_cast<impl::xpath_query_impl*>(_impl));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
PUGI__FN xpath_query::xpath_query(xpath_query&& rhs)
|
PUGI__FN xpath_query::xpath_query(xpath_query&& rhs)
|
||||||
{
|
{
|
||||||
_impl = rhs._impl;
|
_impl = rhs._impl;
|
||||||
|
|||||||
@ -72,6 +72,16 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// If the platform is known to have move semantics support, compile move ctor/operator implementation
|
||||||
|
#ifndef PUGIXML_HAS_MOVE
|
||||||
|
# if __cplusplus >= 201103
|
||||||
|
# define PUGIXML_HAS_MOVE
|
||||||
|
# elif defined(_MSC_VER) && _MSC_VER >= 1800
|
||||||
|
# define PUGIXML_HAS_MOVE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// If C++ is 2011 or higher, add 'override' qualifiers
|
// If C++ is 2011 or higher, add 'override' qualifiers
|
||||||
#ifndef PUGIXML_OVERRIDE
|
#ifndef PUGIXML_OVERRIDE
|
||||||
# if __cplusplus >= 201103
|
# if __cplusplus >= 201103
|
||||||
@ -1117,7 +1127,7 @@ namespace pugi
|
|||||||
xpath_variable_set(const xpath_variable_set& rhs);
|
xpath_variable_set(const xpath_variable_set& rhs);
|
||||||
xpath_variable_set& operator=(const xpath_variable_set& rhs);
|
xpath_variable_set& operator=(const xpath_variable_set& rhs);
|
||||||
|
|
||||||
#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
// Move semantics support
|
// Move semantics support
|
||||||
xpath_variable_set(xpath_variable_set&& rhs);
|
xpath_variable_set(xpath_variable_set&& rhs);
|
||||||
xpath_variable_set& operator=(xpath_variable_set&& rhs);
|
xpath_variable_set& operator=(xpath_variable_set&& rhs);
|
||||||
@ -1161,7 +1171,7 @@ namespace pugi
|
|||||||
// Destructor
|
// Destructor
|
||||||
~xpath_query();
|
~xpath_query();
|
||||||
|
|
||||||
#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
// Move semantics support
|
// Move semantics support
|
||||||
xpath_query(xpath_query&& rhs);
|
xpath_query(xpath_query&& rhs);
|
||||||
xpath_query& operator=(xpath_query&& rhs);
|
xpath_query& operator=(xpath_query&& rhs);
|
||||||
@ -1302,7 +1312,7 @@ namespace pugi
|
|||||||
xpath_node_set(const xpath_node_set& ns);
|
xpath_node_set(const xpath_node_set& ns);
|
||||||
xpath_node_set& operator=(const xpath_node_set& ns);
|
xpath_node_set& operator=(const xpath_node_set& ns);
|
||||||
|
|
||||||
#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
// Move semantics support
|
// Move semantics support
|
||||||
xpath_node_set(xpath_node_set&& rhs);
|
xpath_node_set(xpath_node_set&& rhs);
|
||||||
xpath_node_set& operator=(xpath_node_set&& rhs);
|
xpath_node_set& operator=(xpath_node_set&& rhs);
|
||||||
|
|||||||
@ -418,7 +418,7 @@ TEST(xpath_api_empty)
|
|||||||
CHECK(!q.evaluate_boolean(c));
|
CHECK(!q.evaluate_boolean(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus >= 201103
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
TEST_XML(xpath_api_nodeset_move_ctor, "<node><foo/><foo/><bar/></node>")
|
TEST_XML(xpath_api_nodeset_move_ctor, "<node><foo/><foo/><bar/></node>")
|
||||||
{
|
{
|
||||||
xpath_node_set set = doc.select_nodes(STR("node/bar/preceding::*"));
|
xpath_node_set set = doc.select_nodes(STR("node/bar/preceding::*"));
|
||||||
|
|||||||
@ -474,7 +474,7 @@ TEST_XML(xpath_variables_copy_out_of_memory, "<node1 /><node2 />")
|
|||||||
CHECK(set2.get(STR("d"))->get_node_set().size() == 2);
|
CHECK(set2.get(STR("d"))->get_node_set().size() == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus >= 201103
|
#ifdef PUGIXML_HAS_MOVE
|
||||||
TEST_XML(xpath_variables_move, "<node />")
|
TEST_XML(xpath_variables_move, "<node />")
|
||||||
{
|
{
|
||||||
xpath_variable_set set;
|
xpath_variable_set set;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user