From: David Abrahams (dave_at_[hidden])
Date: 2005-12-08 16:52:19
Matthias Troyer <troyer_at_[hidden]> writes:
> I see two ways how this can be implemented and wanted to discuss what
> option is best in your opinion:
> i) the load function for std::vector could dispatch to either version
> A or B depending on the type traits has_trivial_constructor<T>
ia) define the has_default_constructor<T> trait, which by default
is derived from has_trivial_constructor<T> on implementations
without magic compiler support.
> ii) one could leave std::vector serialization untouched, meaning
> always use version A, and use the optimized version B only in the
> archive wrapper for archives implementing fast array serialization.
> The advantage of this is that these archives know for which types
> they provide fast array serialization, and could override the
> std::vector serialization just for these types.
That one scares me a lot. The archive author doesn't know the full
range of element types T for which vector<T> can be
fast-array-serialized, does he? What happens when I invent a new POD
that I want to stick in vectors that will be serialized? Do I have to
go modify the archive? Or have I misundestood this altogether?
-- Dave Abrahams Boost Consulting www.boost-consulting.com