Can 'iterator' type just subclass 'const_iterator'?

Posted by doublep on Stack Overflow See other posts from Stack Overflow or by doublep
Published on 2010-05-16T16:18:12Z Indexed on 2010/05/16 16:20 UTC
Read the original article Hit count: 210

Filed under:
|
|
|

After another question about iterators I'm having some doubts about custom containers. In my container, iterator is a subclass of const_iterator, so that I get conversion from non-const to const "for free". But is this allowed or are there any drawbacks or non-working scenarios for such a setup?

© Stack Overflow or respective owner

Related posts about c++

Related posts about container