mirror of
https://github.com/boostorg/unordered.git
synced 2025-11-21 17:59:54 +01:00
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:
@@ -478,7 +478,7 @@ namespace boost {
|
||||
size_type insert_or_visit(std::initializer_list<value_type> ilist, F f)
|
||||
{
|
||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_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>
|
||||
@@ -520,7 +520,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 F1, class F2>
|
||||
@@ -569,7 +569,8 @@ namespace boost {
|
||||
{
|
||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F1)
|
||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_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>
|
||||
@@ -619,7 +620,8 @@ namespace boost {
|
||||
{
|
||||
BOOST_UNORDERED_STATIC_ASSERT_CONST_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... Args> BOOST_FORCEINLINE bool emplace(Args&&... args)
|
||||
|
||||
Reference in New Issue
Block a user