Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] STL Containers and Non-Default Constructors
From: Robert Ramey (ramey_at_[hidden])
Date: 2015-05-24 15:49:02


On 5/23/15 6:07 PM, Trevor Thoele wrote:
> The problem with std::vector and std::list (and the other sequential,
> non-associative containers) is that regardless of is_default_contructible<T>
> with T being non-default constructible, the compiler will generate code that
> calls T::T() and will have a compiler error because of it.

I know that. The current version uploaded to devel and merged to release
addresses this problem such that I don't think that it will occur any
more. It's currently passing tests on all gcc, clang and msvc platforms.

In order to do this I had to:

define a custom version if is_default_constructable - I don't know if
that is really necessary. but I seemed to have some issues with the
default one. It didnt' fix the total problem so maybe in hindsight it
wasn't necessary, but for now it's in there.

I had to do use different algorithms depending on whether
is_default_constructible resolves to true or false.

And I enhanced tests to detect future failures. I believe that this
issue is resolved. Feel free to inspect the current version and let me
know if I got something wroing.

I did detect some unexploited opportunities to improve peformance with
C++11 and also some interface errors on very obscure functions. But for
now I'm moving on to something else.

Robert Ramey.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net