K
Kai-Uwe Bux
Pete said:Kai-Uwe Bux wrote: [snip]I recall that some code that used to work
perfectly fine broke when my standard library incorporated concept checks
(however, my memory is notoriously unreliable and could be making this
up). At that point, I learned that the standard requires complete types
for the template arguments in many places even in cases where there there
are natural implementations that would not need that. I think, the
assumption that you can meaningfully derive from set::iterator is not
that different.
On the contrary: it is quite different. The C++ specification explicitly
says that you cannot use incomplete types in that context, so you
violated an express prohibition. There is no such prohibition on
deriving from std::const_iterator, and no reasonable implementation will
prevent that.
The standard explictly marks the type std::set::const_iterator as
implementation_defined. The cases may not be exactly parallel, but relying
on being able to derive from set::const_iterator is formally implementation
defined behavior.
Best
Kai-Uwe Bux