Boost logo

Boost :

Subject: Re: [boost] boost::aligned_storage is not a POD.
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-02-11 17:01:24


On 02/11/17 19:25, Vicente J. Botet Escriba via Boost wrote:
> Hi,
>
> boost::aligned_storage is not a POD.
>
> I suspect it is because of the declared constructors
>
>
> private: // noncopyable
>
> aligned_storage(const aligned_storage&);
> aligned_storage& operator=(const aligned_storage&);
>
> public: // structors
>
> aligned_storage()
> {
> }
>
> ~aligned_storage()
> {
> }
>
>
> Was this intentional?
>
> Why aligned_storage is not copyable?

The usage pattern of boost::aligned_storage is different from that of
std::aligned_storage. You can get a POD type through the nested type
typedef:

   typedef boost::aligned_storage< 16 >::type aligned_storage_pod;

I think, boost::aligned_storage is not copyable because it doesn't know
how to copy the contents. And since in C++03 it can't define =default
constructors, it had to define a user-defined constructor making the
type non-POD.


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