mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-10 07:33:53 +00:00
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:
parent
4fe679bb0d
commit
c2929ea6c6
@ -50,11 +50,11 @@ the integers greater than `-2`.
|
|||||||
// Another example using make_filter_iterator()
|
// Another example using make_filter_iterator()
|
||||||
std::copy(
|
std::copy(
|
||||||
boost::make_filter_iterator(
|
boost::make_filter_iterator(
|
||||||
std::bind2nd(std::greater<int>(), -2)
|
std::bind(std::greater<int>(), std::placeholders::_1, -2)
|
||||||
, numbers, numbers + N)
|
, numbers, numbers + N)
|
||||||
|
|
||||||
, boost::make_filter_iterator(
|
, boost::make_filter_iterator(
|
||||||
std::bind2nd(std::greater<int>(), -2)
|
std::bind(std::greater<int>(), std::placeholders::_1, -2)
|
||||||
, numbers + N, numbers + N)
|
, numbers + N, numbers + N)
|
||||||
|
|
||||||
, std::ostream_iterator<int>(std::cout, " ")
|
, std::ostream_iterator<int>(std::cout, " ")
|
||||||
|
@ -49,7 +49,7 @@ using the `make_indirect_iterator` helper function.
|
|||||||
const_indirect_last(pointers_to_chars + N);
|
const_indirect_last(pointers_to_chars + N);
|
||||||
|
|
||||||
std::transform(const_indirect_first, const_indirect_last,
|
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::copy(mutable_indirect_first, mutable_indirect_last,
|
||||||
std::ostream_iterator<char>(std::cout, ","));
|
std::ostream_iterator<char>(std::cout, ","));
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/iterator/filter_iterator.hpp>
|
#include <boost/iterator/filter_iterator.hpp>
|
||||||
|
#include <boost/bind/bind.hpp>
|
||||||
#include <boost/cstdlib.hpp> // for exit_success
|
#include <boost/cstdlib.hpp> // for exit_success
|
||||||
|
|
||||||
struct is_positive_number {
|
struct is_positive_number {
|
||||||
@ -42,11 +43,11 @@ int main()
|
|||||||
// Another example using make_filter_iterator()
|
// Another example using make_filter_iterator()
|
||||||
std::copy(
|
std::copy(
|
||||||
boost::make_filter_iterator(
|
boost::make_filter_iterator(
|
||||||
std::bind2nd(std::greater<int>(), -2)
|
boost::bind(std::greater<int>(), boost::placeholders::_1, -2)
|
||||||
, numbers, numbers + N)
|
, numbers, numbers + N)
|
||||||
|
|
||||||
, boost::make_filter_iterator(
|
, boost::make_filter_iterator(
|
||||||
std::bind2nd(std::greater<int>(), -2)
|
boost::bind(std::greater<int>(), boost::placeholders::_1, -2)
|
||||||
, numbers + N, numbers + N)
|
, numbers + N, numbers + N)
|
||||||
|
|
||||||
, std::ostream_iterator<int>(std::cout, " ")
|
, std::ostream_iterator<int>(std::cout, " ")
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <boost/bind/bind.hpp>
|
||||||
#include <boost/iterator/indirect_iterator.hpp>
|
#include <boost/iterator/indirect_iterator.hpp>
|
||||||
|
|
||||||
int main(int, char*[])
|
int main(int, char*[])
|
||||||
@ -41,7 +42,7 @@ int main(int, char*[])
|
|||||||
const_indirect_last(pointers_to_chars + N);
|
const_indirect_last(pointers_to_chars + N);
|
||||||
|
|
||||||
std::transform(const_indirect_first, const_indirect_last,
|
std::transform(const_indirect_first, const_indirect_last,
|
||||||
mutable_indirect_first, std::bind1st(std::plus<char>(), 1));
|
mutable_indirect_first, boost::bind(std::plus<char>(), 1, boost::placeholders::_1));
|
||||||
|
|
||||||
std::copy(mutable_indirect_first, mutable_indirect_last,
|
std::copy(mutable_indirect_first, mutable_indirect_last,
|
||||||
std::ostream_iterator<char>(std::cout, ","));
|
std::ostream_iterator<char>(std::cout, ","));
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include <boost/iterator/iterator_concepts.hpp>
|
#include <boost/iterator/iterator_concepts.hpp>
|
||||||
#include <boost/iterator/new_iterator_tests.hpp>
|
#include <boost/iterator/new_iterator_tests.hpp>
|
||||||
#include <boost/pending/iterator_tests.hpp>
|
#include <boost/pending/iterator_tests.hpp>
|
||||||
#include <boost/bind.hpp>
|
|
||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user