Constructors in fixed_vectors.

Joaquim Duran Comas <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <CAMnFju7XkuYxBd7RzSOq3Fg=cpCn-G-dHe=7vZtA=gH0oVdSeg@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.