Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2022-04-04 08:05:09


On 4/4/22 03:01, Gavin Lambert via Boost wrote:
> On 4/04/2022 10:58, Marshall Clow wrote:
>> On Apr 3, 2022, at 3:09 PM, Viktor Sehr wrote:
>>>
>>> Why not return a pointer/nullptr instead? pfind_if
>>
>> Why not just check to see if the returned iterator == end () ?
>
> The annoyance with the iterator == end() implementation is that it's a
> double indirection -- if you want to access the value afterwards it has
> to be in a separate statement, which means you can't do it with an
> rvalue collection.

I don't see creating a variable as that much of a problem. Besides,
C++17 adds support for variable declarations in the `if` statement.


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