Boost logo

Boost :

Subject: Re: [boost] Query regarding time complexity requirements of iterators in custom container
From: Rob Stewart (rob.stewart_at_[hidden])
Date: 2016-01-25 04:09:57

On January 24, 2016 4:10:19 PM EST, Soul Studios <matt_at_[hidden]> wrote:
> > I don't know anything about Colony, but violating requirements for
> iterators would not be a good idea. However, if you provide a
> non-standard means to access the iterators, you could give users the
> choice to gain random access while not accidentally using the
> non-conforming random access iterators in normal contexts. IOW, don't
> use begin() and end(), but some variant thereof.
> I see what you mean, however not sure if providing an additional
> iterator type would solve the problem from the point of view of the
> standard - you'd still be giving std::find and the like with an
> iterator
> and by definition that iterator must be compliant - which it wouldn't
> be.

The difference is that the user is choosing to use the non-conforming iterators with knowledge aforethought. Yes, it can increase std::find()'s complexity, which is non-conforming, but it will work and the user will have selected it. I see it as similar to using insert(begin(), value) when push_front() isn't available.


(Sent from my portable computation engine)

Boost list run by bdawes at, gregod at, cpdaniel at, john at