Use as_const to remove any possibility of use-after-move (#272)

This commit is contained in:
Braden Ganetsky
2024-08-06 15:48:13 +02:00
committed by GitHub
parent cd4c1f3713
commit 65f3ea60dd
3 changed files with 15 additions and 4 deletions
+2 -2
View File
@@ -198,7 +198,7 @@ namespace boost {
template <class... Args> std::pair<iterator, bool> emplace(Args&&... args)
{
return table_.emplace_unique(
table::extractor::extract(std::forward<Args>(args)...),
table::extractor::extract(detail::as_const(args)...),
std::forward<Args>(args)...);
}
@@ -206,7 +206,7 @@ namespace boost {
iterator emplace_hint(const_iterator hint, Args&&... args)
{
return table_.emplace_hint_unique(hint,
table::extractor::extract(std::forward<Args>(args)...),
table::extractor::extract(detail::as_const(args)...),
std::forward<Args>(args)...);
}