Boost logo

Boost :

Subject: Re: [boost] [review] Review of PolyCollection starts today (May 3rd)
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2017-05-13 00:50:04


Gavin Lambert wrote:
> On that note, do you know of a more-comprehensible-than-standardese guide
> on how allocator_traits is supposed to be used for node-based custom
> container types? I've tried to figure it out a couple times but I'm sure I'm
> missing important points.

What do you want to know?

1. The storage for the node should be allocated with the Allocator's
'allocate()', for an allocator instance 'a' whose value_type is the
containers node type (i.e. 'a' can be achieved by rebinding an
existing allocator instance in the normal way).

2. The node object itself would be constructed in the normal way -
e.g. placement new to construct the node object.

3. The containers' value_type object within the node must be
constructed by allocator_traits<U>::construct(u, p, args...) where u
of type U is a rebound copy of the allocator such that the allocator's
value_type is the container's value_type.

4. Similar to 3, for destruction of the container's value_type object
should be destroyed by allocator_traits<U>::destroy(u, p)

5. Similar to 2, the node object is destroyed in the normal way - e.g.
invoking the destructor of the node type.

Glen


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