Boost logo

Boost :

From: Arthur Gruzauskas (grattle_at_[hidden])
Date: 2019-12-18 06:47:16


On Wednesday, 18 December 2019 1:24:21 PM AEDT Zach Laine via Boost wrote:

[snip]
> > My one small concern is in the required method:
> >
> > constexpr auto operator-(repeated_chars_iterator other) const noexcept
> >
> > instead of:
> >
> > constexpr auto operator-(const repeated_chars_iterator& other) const
> > noexcept
> >
>
> In short, I'm doing this for two reasons:
>
> 1) An iterator type is typically the size of a pointer or maybe two, and so
> pass-by-value is usually more optimal than pass-by-reference.
> 2) All the STL interfaces that take iterators do it this way, and so making
> the STLInterfaces usage pass-by-reference probably won't affect >= 90% of
> your uses of a given iterator type.
>
> Zach
>

I had not thought about the need for an iterator to be lightweight before...

A revisiting of some standard STL algorithms implies copying iterators should
be quick so as to not impinge on the algorithms' performance.

Both 1) & 2) make sense.

I withdraw my small concern.

Arthur, who now only likes lightweight iterators


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk