Search code examples
c++c++17inserter

std::inserter replacement for C++17


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.


Solution

  • 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.