Den 27-09-2017 kl. 01:08 skrev Daniel James via Boost:
On 26 September 2017 at 22:20, Tim Song via Boost
wrote: On Tue, Sep 26, 2017 at 5:06 PM, Benedek Thaler via Boost
wrote: On Tue, Sep 26, 2017 at 2:43 AM, Tim Song via Boost
wrote:; Why are pointers being used as iterator types directly?
To keep simple things simple. What's wrong with pointers?
Using pointers directly makes it easier to write buggy code. A custom iterator type, even if just a thin wrapper, provides more type safety.
That's a pretty slim advantage, I'd value simplicity more. It's very much a judgement call.
I think Boost.Container uses a simple wrapper around T*, but at the same time has a macro that can be defined to turn it into pointers again. I would expect that some code does things differently if they are passed two pointers instead of two iterators. kind regards Thorsten