Boost logo

Ublas :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2007-02-01 13:59:48


I am (once again) looking into avoiding unnecessary construction of
vector/matrix. In particular, this is interesting for std::complex, since
(unfortunately) it's constructor is non-trivial.

I am looking into the following. In storage.hpp, use

boost::has_trivial_constructor

to dispatch.

Then, add an partial specialization of

template<typename FLT>
struct has_trivial_constructor<std::complex<FLT> > : true_type {};

In addition, I also suggest adding constructors such as:

vector (size, init_value)
matrix (size1, size2, init_value)

Thus, for primitive types (including complex, which should really be
primitive),

vector (size), matrix (size1, size2) do not default construct the elements,
but if you really want a specific init, just ask for it.

Any interest?