From: Stefan S. <se...@sy...> - 2003-02-11 14:19:36
|
Jonathan Wakely wrote: > What if a NodeList cannot be constructed from a const NodeList ? > e.g. its copy ctor takes a non-const reference like auto_ptr, or it has > private copy ctor to make it non-copyable. a const container of objects is not the same as a container of const objects. What you are describing is a const container, while what we want is a container of const objects. > That would allow a const Node to return a const NodeList, which can't be > turned into a non-const NodeList, and so will only yield read-only > const_iterators. yeah, that may work. > It might still be necessary to have a separate ConstNodeList class, but > IMHO it would be better if "deep-constness" can be done correctly with a > single NodeList class. well, I don't think it can (conceptually). That's the point of defining 'const_iterator' instead of just having 'const iterator'. Stefan |