You need to write an iterator class for std::set . How to write a constructor, so that in the end he kept a pointer to an element of the set? For example, for a vector, you can pass &v[0] and save, and how?

  • And what does not suit the usual std::set::iterator ? - yrHeTaTeJlb
  • @yrHeTaTeJlb suits everyone. The job is. CLASSIC NICK - Peter
  • It was thought - and how much generally it is possible to write the iterator without knowledge of interiors of a class of the container? In a non-trivial case? - Harry
  • Understand the problem, the stl-style iterator simulates the behavior of pointers. std::set uses bidirectional iterators. For them, you need to define the operators ++ and -- . To move from one element to another you need to know the internal structure of the container. You don't have access to it - yrHeTaTeJlb
  • one
    @pavel and its implementation of std:: where to put this set . - αλεχολυτ

0