More n3644 changes - forward_list and deque

Howard Hinnant hhinnant at apple.com
Wed Aug 7 11:42:23 PDT 2013


On Aug 7, 2013, at 1:01 PM, David Blaikie <dblaikie at gmail.com> wrote:

> One thing I have done in real code is to put pairs of iterators
> (representing the usual range abstraction) into a container - granted
> I think I just used a sequence, not an associative container, but I
> think even in the associative case I could imagine using that as a map
> key & this still requires < comparison over iterators from different
> containers. But if it's invalid, it's invalid - I can live with that.

This reminds me a little of the std::complex case.  I have heard arguments that less<complex<T>> should be defined so that complex<T> can be made a key in a map or set.  Others argue that there is no universally accepted order for complex<T> and that we should not invent one.

In both the complex case, and the iterator case, a determined coder can work around the issue with a custom compare functor.  And then there's always the unordered containers we can now use.

In both cases the arguments against interoperability with map/set include:

There is no well-defined order, so we shouldn't pretend to support one.

And in both cases the arguments for interoperability with map/set include:

I don't care what the order is, I just want one.

> Granted when I did this, even with a sequence, MSVC's debug checks
> helped me a /lot/ in identifying cases where I ended up comparing
> iterators from different containers, etc.

Thanks for the feedback.

Howard




More information about the cfe-commits mailing list