0

In this post: set_intersection uses std::inserter as follows:

std::set_intersection(
    netSet.begin(), netSet.end(),
    portSet.begin(), portSet.end(),
    std::inserter(result, result.end())
);

However, std::inserter is no longer available with C++17 so how should this code be rewritten?

EDIT: As many have pointed out, std::inserter is still available in C++17. Somehow I ended up reading how std::iterator had been deprecated not realising that it wasn't referring to std::inserter. My problem was solved by specifically including the <iterator> header in my code.

user3717478
  • 863
  • 1
  • 8
  • 15
  • 4
    Where did you see `std::inserter` will not be available? I don't believe it's removed or even deprecated. – aschepler Aug 14 '17 at 12:17
  • 1
    [It's not deprecated or removed...](http://www.cplusplus.com/reference/iterator/inserter/) – The Quantum Physicist Aug 14 '17 at 12:18
  • 2
    Perhaps you are thinking of [`std::iterator`](http://en.cppreference.com/w/cpp/iterator/iterator), which was intended to help provide the `typedef`s needed when creating your own iterators, but was concluded not to be very useful and hence deprecated? – BoBTFish Aug 14 '17 at 12:22
  • https://stackoverflow.com/questions/37031805/preparation-for-stditerator-being-deprecated – Jonathan Mee Aug 14 '17 at 12:31

1 Answers1

2

std::inserter is no longer available with

That's not true!

There is no indication that std::inserter will be removed from C++17, or that it will become deprecated.


I was getting confused with std::iterator

Preparation for std::iterator Being Deprecated.

gsamaras
  • 71,951
  • 46
  • 188
  • 305