Updated to use boost/bind/bind.hpp to avoid warnings and compliance with C++20.

boost/bind.hpp emits warnings about deprecating global placeholder argument
keywords. C++20 removes std::bind1st/bind2nd, so replaced their usage with
boost::bind.
This commit is contained in:
Andrey Semashev
2020-03-04 01:02:52 +03:00
parent 4fe679bb0d
commit c2929ea6c6
5 changed files with 22 additions and 21 deletions

View File

@@ -50,11 +50,11 @@ the integers greater than `-2`.
// Another example using make_filter_iterator()
std::copy(
boost::make_filter_iterator(
std::bind2nd(std::greater<int>(), -2)
std::bind(std::greater<int>(), std::placeholders::_1, -2)
, numbers, numbers + N)
, boost::make_filter_iterator(
std::bind2nd(std::greater<int>(), -2)
std::bind(std::greater<int>(), std::placeholders::_1, -2)
, numbers + N, numbers + N)
, std::ostream_iterator<int>(std::cout, " ")

View File

@@ -49,7 +49,7 @@ using the `make_indirect_iterator` helper function.
const_indirect_last(pointers_to_chars + N);
std::transform(const_indirect_first, const_indirect_last,
mutable_indirect_first, std::bind1st(std::plus<char>(), 1));
mutable_indirect_first, std::bind(std::plus<char>(), 1, std::placeholders::_1));
std::copy(mutable_indirect_first, mutable_indirect_last,
std::ostream_iterator<char>(std::cout, ","));