forked from boostorg/unordered
swapped stats on move construction/assignment
This commit is contained in:
@@ -1161,12 +1161,16 @@ struct table_core_stats
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define BOOST_UNORDERED_ADD_STATS(stats,args) stats.add args
|
#define BOOST_UNORDERED_ADD_STATS(stats,args) stats.add args
|
||||||
|
#define BOOST_UNORDERED_SWAP_STATS(stats1,stats2) std::swap(stats1,stats2)
|
||||||
|
#define BOOST_UNORDERED_RESET_STATS_OF(x) x.reset_stats()
|
||||||
#define BOOST_UNORDERED_STATS_COUNTER(name) std::size_t name=0
|
#define BOOST_UNORDERED_STATS_COUNTER(name) std::size_t name=0
|
||||||
#define BOOST_UNORDERED_INCREMENT_STATS_COUNTER(name) ++name
|
#define BOOST_UNORDERED_INCREMENT_STATS_COUNTER(name) ++name
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define BOOST_UNORDERED_ADD_STATS(stats,args) ((void)0)
|
#define BOOST_UNORDERED_ADD_STATS(stats,args) ((void)0)
|
||||||
|
#define BOOST_UNORDERED_SWAP_STATS(stats1,stats2) ((void)0)
|
||||||
|
#define BOOST_UNORDERED_RESET_STATS_OF(x) ((void)0)
|
||||||
#define BOOST_UNORDERED_STATS_COUNTER(name) ((void)0)
|
#define BOOST_UNORDERED_STATS_COUNTER(name) ((void)0)
|
||||||
#define BOOST_UNORDERED_INCREMENT_STATS_COUNTER(name) ((void)0)
|
#define BOOST_UNORDERED_INCREMENT_STATS_COUNTER(name) ((void)0)
|
||||||
|
|
||||||
@@ -1481,6 +1485,7 @@ public:
|
|||||||
x.arrays=ah.release();
|
x.arrays=ah.release();
|
||||||
x.size_ctrl.ml=x.initial_max_load();
|
x.size_ctrl.ml=x.initial_max_load();
|
||||||
x.size_ctrl.size=0;
|
x.size_ctrl.size=0;
|
||||||
|
BOOST_UNORDERED_SWAP_STATS(cstats,x.cstats);
|
||||||
}
|
}
|
||||||
|
|
||||||
table_core(table_core&& x)
|
table_core(table_core&& x)
|
||||||
@@ -1506,11 +1511,13 @@ public:
|
|||||||
using std::swap;
|
using std::swap;
|
||||||
swap(arrays,x.arrays);
|
swap(arrays,x.arrays);
|
||||||
swap(size_ctrl,x.size_ctrl);
|
swap(size_ctrl,x.size_ctrl);
|
||||||
|
BOOST_UNORDERED_SWAP_STATS(cstats,x.cstats);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
reserve(x.size());
|
reserve(x.size());
|
||||||
clear_on_exit c{x};
|
clear_on_exit c{x};
|
||||||
(void)c; /* unused var warning */
|
(void)c; /* unused var warning */
|
||||||
|
BOOST_UNORDERED_RESET_STATS_OF(x);
|
||||||
|
|
||||||
/* This works because subsequent x.clear() does not depend on the
|
/* This works because subsequent x.clear() does not depend on the
|
||||||
* elements' values.
|
* elements' values.
|
||||||
|
Reference in New Issue
Block a user