forked from boostorg/unordered
Merge pull request #287 from k3DW/insert-return-type
Change the range insertion return type match the documentation
This commit is contained in:
@ -419,16 +419,18 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
void insert(InputIterator begin, InputIterator end)
|
size_type insert(InputIterator begin, InputIterator end)
|
||||||
{
|
{
|
||||||
for (auto pos = begin; pos != end; ++pos) {
|
size_type count_elements = 0;
|
||||||
|
for (auto pos = begin; pos != end; ++pos, ++count_elements) {
|
||||||
table_.emplace(*pos);
|
table_.emplace(*pos);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(std::initializer_list<value_type> ilist)
|
size_type insert(std::initializer_list<value_type> ilist)
|
||||||
{
|
{
|
||||||
this->insert(ilist.begin(), ilist.end());
|
return this->insert(ilist.begin(), ilist.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class M>
|
template <class M>
|
||||||
@ -471,19 +473,21 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F>
|
template <class InputIterator, class F>
|
||||||
void insert_or_visit(InputIterator first, InputIterator last, F f)
|
size_type insert_or_visit(InputIterator first, InputIterator last, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_or_visit(*first, f);
|
table_.emplace_or_visit(*first, f);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
size_type insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
|
||||||
this->insert_or_visit(ilist.begin(), ilist.end(), f);
|
return this->insert_or_visit(ilist.begin(), ilist.end(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Ty, class F>
|
template <class Ty, class F>
|
||||||
@ -502,19 +506,21 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F>
|
template <class InputIterator, class F>
|
||||||
void insert_or_cvisit(InputIterator first, InputIterator last, F f)
|
size_type insert_or_cvisit(InputIterator first, InputIterator last, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_or_cvisit(*first, f);
|
table_.emplace_or_cvisit(*first, f);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
|
size_type insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
|
return this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Ty, class F1, class F2>
|
template <class Ty, class F1, class F2>
|
||||||
@ -535,23 +541,25 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F1, class F2>
|
template <class InputIterator, class F1, class F2>
|
||||||
void insert_and_visit(
|
size_type insert_and_visit(
|
||||||
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_and_visit(*first, f1, f2);
|
table_.emplace_and_visit(*first, f1, f2);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
void insert_and_visit(
|
size_type insert_and_visit(
|
||||||
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
|
||||||
this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
|
return this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Ty, class F1, class F2>
|
template <class Ty, class F1, class F2>
|
||||||
@ -572,23 +580,25 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F1, class F2>
|
template <class InputIterator, class F1, class F2>
|
||||||
void insert_and_cvisit(
|
size_type insert_and_cvisit(
|
||||||
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_and_cvisit(*first, f1, f2);
|
table_.emplace_and_cvisit(*first, f1, f2);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
void insert_and_cvisit(
|
size_type insert_and_cvisit(
|
||||||
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
|
return this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... Args> BOOST_FORCEINLINE bool emplace(Args&&... args)
|
template <class... Args> BOOST_FORCEINLINE bool emplace(Args&&... args)
|
||||||
|
@ -425,16 +425,18 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
void insert(InputIterator begin, InputIterator end)
|
size_type insert(InputIterator begin, InputIterator end)
|
||||||
{
|
{
|
||||||
for (auto pos = begin; pos != end; ++pos) {
|
size_type count_elements = 0;
|
||||||
|
for (auto pos = begin; pos != end; ++pos, ++count_elements) {
|
||||||
table_.emplace(*pos);
|
table_.emplace(*pos);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(std::initializer_list<value_type> ilist)
|
size_type insert(std::initializer_list<value_type> ilist)
|
||||||
{
|
{
|
||||||
this->insert(ilist.begin(), ilist.end());
|
return this->insert(ilist.begin(), ilist.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
@ -462,19 +464,21 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F>
|
template <class InputIterator, class F>
|
||||||
void insert_or_visit(InputIterator first, InputIterator last, F f)
|
size_type insert_or_visit(InputIterator first, InputIterator last, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_or_visit(*first, f);
|
table_.emplace_or_visit(*first, f);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
size_type insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
this->insert_or_visit(ilist.begin(), ilist.end(), f);
|
return this->insert_or_visit(ilist.begin(), ilist.end(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
@ -502,19 +506,21 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F>
|
template <class InputIterator, class F>
|
||||||
void insert_or_cvisit(InputIterator first, InputIterator last, F f)
|
size_type insert_or_cvisit(InputIterator first, InputIterator last, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_or_cvisit(*first, f);
|
table_.emplace_or_cvisit(*first, f);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
|
size_type insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
|
return this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
@ -546,22 +552,24 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F1, class F2>
|
template <class InputIterator, class F1, class F2>
|
||||||
void insert_and_visit(
|
size_type insert_and_visit(
|
||||||
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_and_visit(*first, f1, f2);
|
table_.emplace_and_visit(*first, f1, f2);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
void insert_and_visit(std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
size_type insert_and_visit(std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
|
return this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
@ -593,23 +601,25 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F1, class F2>
|
template <class InputIterator, class F1, class F2>
|
||||||
void insert_and_cvisit(
|
size_type insert_and_cvisit(
|
||||||
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_and_cvisit(*first, f1, f2);
|
table_.emplace_and_cvisit(*first, f1, f2);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
void insert_and_cvisit(
|
size_type insert_and_cvisit(
|
||||||
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
|
return this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... Args> BOOST_FORCEINLINE bool emplace(Args&&... args)
|
template <class... Args> BOOST_FORCEINLINE bool emplace(Args&&... args)
|
||||||
|
@ -426,16 +426,18 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
void insert(InputIterator begin, InputIterator end)
|
size_type insert(InputIterator begin, InputIterator end)
|
||||||
{
|
{
|
||||||
for (auto pos = begin; pos != end; ++pos) {
|
size_type count_elements = 0;
|
||||||
|
for (auto pos = begin; pos != end; ++pos, ++count_elements) {
|
||||||
table_.emplace(*pos);
|
table_.emplace(*pos);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(std::initializer_list<value_type> ilist)
|
size_type insert(std::initializer_list<value_type> ilist)
|
||||||
{
|
{
|
||||||
this->insert(ilist.begin(), ilist.end());
|
return this->insert(ilist.begin(), ilist.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
insert_return_type insert(node_type&& nh)
|
insert_return_type insert(node_type&& nh)
|
||||||
@ -497,19 +499,21 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F>
|
template <class InputIterator, class F>
|
||||||
void insert_or_visit(InputIterator first, InputIterator last, F f)
|
size_type insert_or_visit(InputIterator first, InputIterator last, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_or_visit(*first, f);
|
table_.emplace_or_visit(*first, f);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
size_type insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
|
||||||
this->insert_or_visit(ilist.begin(), ilist.end(), f);
|
return this->insert_or_visit(ilist.begin(), ilist.end(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
@ -549,19 +553,21 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F>
|
template <class InputIterator, class F>
|
||||||
void insert_or_cvisit(InputIterator first, InputIterator last, F f)
|
size_type insert_or_cvisit(InputIterator first, InputIterator last, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_or_cvisit(*first, f);
|
table_.emplace_or_cvisit(*first, f);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
|
size_type insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
|
return this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
@ -603,23 +609,25 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F1, class F2>
|
template <class InputIterator, class F1, class F2>
|
||||||
void insert_and_visit(
|
size_type insert_and_visit(
|
||||||
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_and_visit(*first, f1, f2);
|
table_.emplace_and_visit(*first, f1, f2);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
void insert_and_visit(
|
size_type insert_and_visit(
|
||||||
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
|
||||||
this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
|
return this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
@ -662,23 +670,25 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F1, class F2>
|
template <class InputIterator, class F1, class F2>
|
||||||
void insert_and_cvisit(
|
size_type insert_and_cvisit(
|
||||||
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_and_cvisit(*first, f1, f2);
|
table_.emplace_and_cvisit(*first, f1, f2);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
void insert_and_cvisit(
|
size_type insert_and_cvisit(
|
||||||
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
|
return this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
|
@ -432,16 +432,18 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
void insert(InputIterator begin, InputIterator end)
|
size_type insert(InputIterator begin, InputIterator end)
|
||||||
{
|
{
|
||||||
for (auto pos = begin; pos != end; ++pos) {
|
size_type count_elements = 0;
|
||||||
|
for (auto pos = begin; pos != end; ++pos, ++count_elements) {
|
||||||
table_.emplace(*pos);
|
table_.emplace(*pos);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(std::initializer_list<value_type> ilist)
|
size_type insert(std::initializer_list<value_type> ilist)
|
||||||
{
|
{
|
||||||
this->insert(ilist.begin(), ilist.end());
|
return this->insert(ilist.begin(), ilist.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
insert_return_type insert(node_type&& nh)
|
insert_return_type insert(node_type&& nh)
|
||||||
@ -488,19 +490,21 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F>
|
template <class InputIterator, class F>
|
||||||
void insert_or_visit(InputIterator first, InputIterator last, F f)
|
size_type insert_or_visit(InputIterator first, InputIterator last, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_or_visit(*first, f);
|
table_.emplace_or_visit(*first, f);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
size_type insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
this->insert_or_visit(ilist.begin(), ilist.end(), f);
|
return this->insert_or_visit(ilist.begin(), ilist.end(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
@ -549,19 +553,21 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F>
|
template <class InputIterator, class F>
|
||||||
void insert_or_cvisit(InputIterator first, InputIterator last, F f)
|
size_type insert_or_cvisit(InputIterator first, InputIterator last, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_or_cvisit(*first, f);
|
table_.emplace_or_cvisit(*first, f);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
void insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
|
size_type insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
|
||||||
this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
|
return this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
@ -614,22 +620,25 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F1, class F2>
|
template <class InputIterator, class F1, class F2>
|
||||||
void insert_and_visit(
|
size_type insert_and_visit(
|
||||||
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_and_visit(*first, f1, f2);
|
table_.emplace_and_visit(*first, f1, f2);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
void insert_and_visit(std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
size_type insert_and_visit(
|
||||||
|
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
|
return this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
@ -683,23 +692,25 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIterator, class F1, class F2>
|
template <class InputIterator, class F1, class F2>
|
||||||
void insert_and_cvisit(
|
size_type insert_and_cvisit(
|
||||||
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
InputIterator first, InputIterator last, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
for (; first != last; ++first) {
|
size_type count_elements = 0;
|
||||||
|
for (; first != last; ++first, ++count_elements) {
|
||||||
table_.emplace_and_cvisit(*first, f1, f2);
|
table_.emplace_and_cvisit(*first, f1, f2);
|
||||||
}
|
}
|
||||||
|
return count_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
void insert_and_cvisit(
|
size_type insert_and_cvisit(
|
||||||
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
std::initializer_list<value_type> ilist, F1 f1, F2 f2)
|
||||||
{
|
{
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
|
||||||
this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
|
return this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F1, class F2>
|
template <class F1, class F2>
|
||||||
|
@ -149,7 +149,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
thread_runner(values2, [&x](boost::span<raii_convertible> s) {
|
thread_runner(values2, [&x](boost::span<raii_convertible> s) {
|
||||||
x.insert(s.begin(), s.end());
|
BOOST_TEST_EQ(x.insert(s.begin(), s.end()), s.size());
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_TEST_EQ(
|
BOOST_TEST_EQ(
|
||||||
@ -768,11 +768,12 @@ namespace {
|
|||||||
std::atomic<std::uint64_t> num_invokes{0};
|
std::atomic<std::uint64_t> num_invokes{0};
|
||||||
thread_runner(
|
thread_runner(
|
||||||
values2, [&x, &num_invokes](boost::span<raii_convertible> s) {
|
values2, [&x, &num_invokes](boost::span<raii_convertible> s) {
|
||||||
x.insert_or_cvisit(s.begin(), s.end(),
|
BOOST_TEST_EQ(x.insert_or_cvisit(s.begin(), s.end(),
|
||||||
[&num_invokes](typename X::value_type const& v) {
|
[&num_invokes](typename X::value_type const& v) {
|
||||||
(void)v;
|
(void)v;
|
||||||
++num_invokes;
|
++num_invokes;
|
||||||
});
|
}),
|
||||||
|
s.size());
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_TEST_EQ(num_invokes, values.size() - x.size());
|
BOOST_TEST_EQ(num_invokes, values.size() - x.size());
|
||||||
@ -813,17 +814,19 @@ namespace {
|
|||||||
|
|
||||||
std::atomic<std::uint64_t> num_inserts{0};
|
std::atomic<std::uint64_t> num_inserts{0};
|
||||||
std::atomic<std::uint64_t> num_invokes{0};
|
std::atomic<std::uint64_t> num_invokes{0};
|
||||||
thread_runner(
|
thread_runner(values2,
|
||||||
values2, [&x, &num_inserts, &num_invokes](boost::span<raii_convertible> s) {
|
[&x, &num_inserts, &num_invokes](boost::span<raii_convertible> s) {
|
||||||
x.insert_and_cvisit(s.begin(), s.end(),
|
BOOST_TEST_EQ(x.insert_and_cvisit(
|
||||||
[&num_inserts](arg_type& v) {
|
s.begin(), s.end(),
|
||||||
(void)v;
|
[&num_inserts](arg_type& v) {
|
||||||
++num_inserts;
|
(void)v;
|
||||||
},
|
++num_inserts;
|
||||||
[&num_invokes](typename X::value_type const& v) {
|
},
|
||||||
(void)v;
|
[&num_invokes](typename X::value_type const& v) {
|
||||||
++num_invokes;
|
(void)v;
|
||||||
});
|
++num_invokes;
|
||||||
|
}),
|
||||||
|
s.size());
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_TEST_EQ(num_inserts, x.size());
|
BOOST_TEST_EQ(num_inserts, x.size());
|
||||||
@ -866,11 +869,12 @@ namespace {
|
|||||||
std::atomic<std::uint64_t> num_invokes{0};
|
std::atomic<std::uint64_t> num_invokes{0};
|
||||||
thread_runner(
|
thread_runner(
|
||||||
values2, [&x, &num_invokes](boost::span<raii_convertible> s) {
|
values2, [&x, &num_invokes](boost::span<raii_convertible> s) {
|
||||||
x.insert_or_visit(s.begin(), s.end(),
|
BOOST_TEST_EQ(x.insert_or_visit(s.begin(), s.end(),
|
||||||
[&num_invokes](arg_type& v) {
|
[&num_invokes](arg_type& v) {
|
||||||
(void)v;
|
(void)v;
|
||||||
++num_invokes;
|
++num_invokes;
|
||||||
});
|
}),
|
||||||
|
s.size());
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_TEST_EQ(num_invokes, values.size() - x.size());
|
BOOST_TEST_EQ(num_invokes, values.size() - x.size());
|
||||||
@ -911,17 +915,19 @@ namespace {
|
|||||||
|
|
||||||
std::atomic<std::uint64_t> num_inserts{0};
|
std::atomic<std::uint64_t> num_inserts{0};
|
||||||
std::atomic<std::uint64_t> num_invokes{0};
|
std::atomic<std::uint64_t> num_invokes{0};
|
||||||
thread_runner(
|
thread_runner(values2,
|
||||||
values2, [&x, &num_inserts, &num_invokes](boost::span<raii_convertible> s) {
|
[&x, &num_inserts, &num_invokes](boost::span<raii_convertible> s) {
|
||||||
x.insert_and_visit(s.begin(), s.end(),
|
BOOST_TEST_EQ(x.insert_and_visit(
|
||||||
[&num_inserts](arg_type& v) {
|
s.begin(), s.end(),
|
||||||
(void)v;
|
[&num_inserts](arg_type& v) {
|
||||||
++num_inserts;
|
(void)v;
|
||||||
},
|
++num_inserts;
|
||||||
[&num_invokes](typename X::value_type const& v) {
|
},
|
||||||
(void)v;
|
[&num_invokes](typename X::value_type const& v) {
|
||||||
++num_invokes;
|
(void)v;
|
||||||
});
|
++num_invokes;
|
||||||
|
}),
|
||||||
|
s.size());
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_TEST_EQ(num_inserts, x.size());
|
BOOST_TEST_EQ(num_inserts, x.size());
|
||||||
@ -996,8 +1002,9 @@ namespace {
|
|||||||
{
|
{
|
||||||
X x;
|
X x;
|
||||||
|
|
||||||
thread_runner(
|
thread_runner(dummy, [&x, &init_list](boost::span<raii>) {
|
||||||
dummy, [&x, &init_list](boost::span<raii>) { x.insert(init_list); });
|
BOOST_TEST_EQ(x.insert(init_list), init_list.size());
|
||||||
|
});
|
||||||
|
|
||||||
BOOST_TEST_EQ(x.size(), reference_cont.size());
|
BOOST_TEST_EQ(x.size(), reference_cont.size());
|
||||||
|
|
||||||
@ -1027,16 +1034,19 @@ namespace {
|
|||||||
X x;
|
X x;
|
||||||
|
|
||||||
thread_runner(dummy, [&x, &init_list, &num_invokes](boost::span<raii>) {
|
thread_runner(dummy, [&x, &init_list, &num_invokes](boost::span<raii>) {
|
||||||
x.insert_or_visit(init_list, [&num_invokes](arg_type& v) {
|
BOOST_TEST_EQ(x.insert_or_visit(init_list,
|
||||||
(void)v;
|
[&num_invokes](arg_type& v) {
|
||||||
++num_invokes;
|
(void)v;
|
||||||
});
|
++num_invokes;
|
||||||
|
}),
|
||||||
|
init_list.size());
|
||||||
|
|
||||||
x.insert_or_cvisit(
|
BOOST_TEST_EQ(x.insert_or_cvisit(init_list,
|
||||||
init_list, [&num_invokes](typename X::value_type const& v) {
|
[&num_invokes](typename X::value_type const& v) {
|
||||||
(void)v;
|
(void)v;
|
||||||
++num_invokes;
|
++num_invokes;
|
||||||
});
|
}),
|
||||||
|
init_list.size());
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_TEST_EQ(num_invokes, (init_list.size() - x.size()) +
|
BOOST_TEST_EQ(num_invokes, (init_list.size() - x.size()) +
|
||||||
@ -1070,29 +1080,32 @@ namespace {
|
|||||||
|
|
||||||
X x;
|
X x;
|
||||||
|
|
||||||
thread_runner(dummy,
|
thread_runner(dummy,
|
||||||
[&x, &init_list, &num_inserts, &num_invokes](boost::span<raii>) {
|
[&x, &init_list, &num_inserts, &num_invokes](boost::span<raii>) {
|
||||||
x.insert_and_visit(init_list,
|
BOOST_TEST_EQ(x.insert_and_visit(
|
||||||
[&num_inserts](arg_type& v) {
|
init_list,
|
||||||
(void)v;
|
[&num_inserts](arg_type& v) {
|
||||||
++num_inserts;
|
(void)v;
|
||||||
},
|
++num_inserts;
|
||||||
[&num_invokes](arg_type& v) {
|
},
|
||||||
(void)v;
|
[&num_invokes](arg_type& v) {
|
||||||
++num_invokes;
|
(void)v;
|
||||||
});
|
++num_invokes;
|
||||||
|
}),
|
||||||
|
init_list.size());
|
||||||
|
|
||||||
x.insert_and_cvisit(
|
BOOST_TEST_EQ(x.insert_and_cvisit(
|
||||||
init_list,
|
init_list,
|
||||||
[&num_inserts](arg_type& v) {
|
[&num_inserts](arg_type& v) {
|
||||||
(void)v;
|
(void)v;
|
||||||
++num_inserts;
|
++num_inserts;
|
||||||
},
|
},
|
||||||
[&num_invokes](typename X::value_type const& v) {
|
[&num_invokes](typename X::value_type const& v) {
|
||||||
(void)v;
|
(void)v;
|
||||||
++num_invokes;
|
++num_invokes;
|
||||||
});
|
}),
|
||||||
});
|
init_list.size());
|
||||||
|
});
|
||||||
|
|
||||||
BOOST_TEST_EQ(num_inserts, x.size());
|
BOOST_TEST_EQ(num_inserts, x.size());
|
||||||
BOOST_TEST_EQ(num_invokes, (init_list.size() - x.size()) +
|
BOOST_TEST_EQ(num_invokes, (init_list.size() - x.size()) +
|
||||||
|
Reference in New Issue
Block a user