What is the OutputIterator used for the std::set container?

  • In what sense is "used for"? Tell us what you want to do. - VladD
  • @VladD I want to use stream iterators to copy elements from the stream into the set container - abvgd
  • And, for insertion? And std::insert_iterator does not roll? - VladD
  • @VladD well, I tried to use inserter(S) , where S — container name — does not work - abvgd

1 answer 1

std::inserter works std::inserter :

 std::vector<int> from = { 1, 2, 3 }; std::set<int> to; std::copy(begin(from), end(from), std::inserter(to, begin(to))); 

Check: http://ideone.com/zJDUsv