|
Boost : |
Subject: Re: [boost] [review] Review of PolyCollection starts today (May 3rd)
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2017-05-14 23:12:41
On Sun, May 14, 2017 at 7:02 PM, Gavin Lambert wrote:
>
> In particular, these rules seem to basically require that the node type be
> trivially-constructible, because you can't legally call the node constructor
> and then call the value constructor where the value is a field of the node;
> you'd have to construct the node, destroy the value, then re-construct the
> value, which seems well over the line into crazypants territory.
>
> It all seems very arbitrary to me.
No. You could also design the node type to contain a
std::aligned_storage_t<sizeof(value_type), alignof(value_type)>
object (instead of containing a value_type object).
That way after you construct the Node type with ::new(x)
Node(args...); you an use std::allocator_traits<U>::construct(u,
address, args...) with the address of that aligned storage.
Glen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk