Use std::ref instead of copying the function parameter… (#290)

* GHA: revise numerous CI jobs. Fix sanitizer on new kernel

* Use std::ref instead of copying the function parameter in std::initializer_list overloads of insert_{or|and}_[c]visit

* Reimplement detail::is_invocable

* Update docs for std::ref(f) changes

---------

Co-authored-by: sdarwin <samuel.d.darwin@gmail.com>
This commit is contained in:
Braden Ganetsky
2024-10-08 17:35:58 +02:00
committed by GitHub
co-authored by sdarwin
parent 94ab2f0776
commit e214ecdbd0
11 changed files with 65 additions and 36 deletions
@@ -513,7 +513,7 @@ namespace boost {
size_type insert_or_visit(std::initializer_list<value_type> ilist, F f)
{
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
return this->insert_or_visit(ilist.begin(), ilist.end(), f);
return this->insert_or_visit(ilist.begin(), ilist.end(), std::ref(f));
}
template <class F>
@@ -567,7 +567,7 @@ namespace boost {
size_type insert_or_cvisit(std::initializer_list<value_type> ilist, F f)
{
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
return this->insert_or_cvisit(ilist.begin(), ilist.end(), f);
return this->insert_or_cvisit(ilist.begin(), ilist.end(), std::ref(f));
}
template <class F>
@@ -627,7 +627,8 @@ namespace boost {
{
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F2)
return this->insert_and_visit(ilist.begin(), ilist.end(), f1, f2);
return this->insert_and_visit(
ilist.begin(), ilist.end(), std::ref(f1), std::ref(f2));
}
template <class F1, class F2>
@@ -688,7 +689,8 @@ namespace boost {
{
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F1)
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F2)
return this->insert_and_cvisit(ilist.begin(), ilist.end(), f1, f2);
return this->insert_and_cvisit(
ilist.begin(), ilist.end(), std::ref(f1), std::ref(f2));
}
template <class F1, class F2>