boost::aligned_storage is not a POD.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

boost::aligned_storage is not a POD.

Boost - Dev mailing list
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?


Best,

Vicente


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: boost::aligned_storage is not a POD.

Boost - Dev mailing list
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.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: boost::aligned_storage is not a POD.

Boost - Dev mailing list
Le 11/02/2017 à 18:01, Andrey Semashev via Boost a écrit :

> 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;
>
Thanks, I missed the usage as a trait.
> 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.
No problem.

Vicente

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost