Boost logo

Boost :

Subject: Re: [boost] devector feedback request
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2015-07-26 11:54:57


Benedek Thaler wrote:
> Dear Boost,
>
> I'm happy to announce the new devector container developed as part of the
> GSoC programme reached a presentable state. I invite you to take a look and
> ask for feedback.

Hi Benedek,

Some feedback:

1. For a given type T whose constructor can throw, and you have a loop
constructing n objects of type T via
std::allocator_traits<T>::construct - should you not be handling that
potential construction failure? (i.e. Destroying those elements that
were constructed before the constructor that throws, before
re-throwing)

e.g. Turning something like:
    for (i = 0; i < n; ++i) {
        // construct i
    }

Into:
    try {
        for (i = 0; i < n; ++i) {
            // construct i
        }
    } catch (...) {
        for (; i > 0; i--) {
            // destroy i-1
        }
        throw;
    }

(My apologies if you already do this, and I missed it).

2. size_type being unsigned int instead of std::size_t - I understand
the motivation, but could this not be customized - e.g. via another
policy? Or should it not instead be based on
std::allocator_traits<Allocator>::size_type instead?

3. I understand deriving from Allocator for EBO, but should that type
be std::allocator_traits<Allocator>::rebind_alloc<T> instead? (And
have the 'allocator_type' member typedef also be this rebound type) .

Best,
Glen


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