Boost logo

Ublas :

Subject: [ublas] Constructors in fixed_vectors.
From: Joaquim Duran Comas (jdurancomas_at_[hidden])
Date: 2015-08-12 18:55:32


Hello,

These days, I'm fixing the issues in tests when they are compiled using
MSCV compiler.

I've an issue with the constructors of fixed_vector. In fixed_vector, MSVC
compiler gets confused with these constructors:

    /// \brief Constructor of a fixed_vector with a unique initial value

    /// \param init value to assign to each element of the vector

         BOOST_UBLAS_INLINE

         fixed_vector (const value_type &init):

             vector_container<self_type> (),

             data_ () {

             data_.fill( init );

         }

and

#if defined(BOOST_MSVC)

        // This may or may not work. Maybe use this for all instead
only for MSVC

        template <typename... U>

        fixed_vector(U&&... values) :

            vector_container<self_type> (),

            data_{{ std::forward<U>(values)... }} {}

#else

        template <typename... Types>

        fixed_vector(value_type v0, Types... vrest) :

            vector_container<self_type> (),

            data_{ { v0, vrest... } } {}

#endif

because, constructing a vector and providing just an unique initial value,
any of these constructors could be called and the compiler reports a
warning.

I propose change the second constructor by providing an inilialization_list
(instead of a variadiric template), where type of elements of the list can
be enforced as well as the length of the list.

Joaquim Duran