Boost logo

Boost :

Subject: Re: [boost] [review] The review of Boost.DoubleEnded starts today: September 21 - September 30
From: Tim Song (t.canens.cpp_at_[hidden])
Date: 2017-09-26 21:20:05


On Tue, Sep 26, 2017 at 5:06 PM, Benedek Thaler via Boost
<boost_at_[hidden]> wrote:
> On Tue, Sep 26, 2017 at 2:43 AM, Tim Song via Boost <boost_at_[hidden]>
> wrote:
>
>> [snip]
>>
>> > typedef pointer iterator;
>> > typedef const_pointer const_iterator;
>>
>> 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.

>
>> More generally, implementation of allocator support requires
>> substantial improvement. An allocator that doesn't propagate on X is
>> not required to support X at all, but there's no handling for that in
>> your code. Another example: construct takes raw pointers, not
>> possibly fancy `pointer` like what you did here:
>> https://github.com/erenon/double_ended/blob/master/
>> include/boost/double_ended/devector.hpp#L2086
>>
>>
> `pointer` is defined by allocator_traits. Couldn't that be a fancy pointer,
> if the Allocator defines it so?

allocate/deallocate use (possibly fancy) `pointer`.
construct/destroy always use raw pointers, never fancy pointers.


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