forked from boostorg/move
Add checks to detect self-move operations
This commit is contained in:
@@ -87,11 +87,13 @@ struct order_move_type
|
|||||||
order_move_type(BOOST_RV_REF(order_move_type) other)
|
order_move_type(BOOST_RV_REF(order_move_type) other)
|
||||||
: key(other.key), val(other.val)
|
: key(other.key), val(other.val)
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(this != &other);
|
||||||
other.key = other.val = std::size_t(-1);
|
other.key = other.val = std::size_t(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
order_move_type & operator=(BOOST_RV_REF(order_move_type) other)
|
order_move_type & operator=(BOOST_RV_REF(order_move_type) other)
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(this != &other);
|
||||||
key = other.key;
|
key = other.key;
|
||||||
val = other.val;
|
val = other.val;
|
||||||
other.key = other.val = std::size_t(-2);
|
other.key = other.val = std::size_t(-2);
|
||||||
|
Reference in New Issue
Block a user