On 02/05/15 19:51 +0200, Daniel Krügler wrote:
2015-05-02 19:33 GMT+02:00 Jonathan Wakely :
Looking at it now, I think the _Internal alias template should also
check that alignof(_Tp) <= alignof(void*) so that it can safely be
stored in the _Storage.
Otherwise a type with sizeof(T) <= sizeof(vo
2015-05-02 19:33 GMT+02:00 Jonathan Wakely :
> Looking at it now, I think the _Internal alias template should also
> check that alignof(_Tp) <= alignof(void*) so that it can safely be
> stored in the _Storage.
>
> Otherwise a type with sizeof(T) <= sizeof(void*) but
> alignof(T) > alignof(void*) wo
On 02/05/15 19:05 +0200, Daniel Krügler wrote:
Not related to the patch, but is the second template argument of
any::_Storage::_M_buffer really correct:
std::aligned_storage::type _M_buffer;
I would have expected to see this to be an alignment value.
Yes, that looks like a typo.
We could rem
2015-05-02 15:03 GMT+02:00 Jonathan Wakely :
> Here's a much smaller patch for the gcc5 branch, which just avoids the
> small-object optimisation for non-trivially-copyable types. This
> pessimises some types, but is safe.
>
> (Given that this stuff is all "experimental" anyway, maybe we could
> ju
On 02/05/15 13:39 +0100, Jonathan Wakely wrote:
My initial implementation of experimental::any was too dumb, it
assumed you could just swap the bytes of _Storage, and return it from
functions like any POD type, but if the _Storage object contains a
non-trivially-copyable object internally (not on
My initial implementation of experimental::any was too dumb, it
assumed you could just swap the bytes of _Storage, and return it from
functions like any POD type, but if the _Storage object contains a
non-trivially-copyable object internally (not on the heap) then it's
wrong to treat it as a POD.