Boost logo

Boost :

Subject: Re: [boost] [utility] prior(it, n) for n being an unsigned type
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-06-24 02:30:07


On Tue, Jun 24, 2014 at 10:21 AM, Adam Romanek <romanek.adam_at_[hidden]> wrote:
> On 23.06.2014 23:21, Andrey Semashev wrote:
>>
>> (...)
>>
>>
>> I've created a pull request:
>>
>> https://github.com/boostorg/utility/pull/15
>>
>> After I read that old discussion I decided to go with a slightly more
>> complicated solution than I originally intended.
>
>
> It became a bit complicated, for such a "simple" utility ;) But I'm glad
> it's been fixed. Thanks!

Not yet. I'll apply the pull request if noone objects in a few days.

> Just out of curiosity - why haven't you chosen the std::reverse_iterator
> -based approach described in the old thread?

Dave Abrahams (the original author) stated that he intended this
utility to be also usable with integers. You can see that in the
discussion [1]. I felt obligated to fulfill that requirement, and
using std::advance and reverse_iterator contradicted that. I could
have used reverse_iterator in the iterator-related part but, well,
deducing the signed integer type looked more straightforward to me.

[1] http://lists.boost.org/Archives/boost/2004/02/61583.php


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