Boost logo

Boost Users :

Subject: [Boost-users] Boost.Array intialisation
From: gast128 (gast128_at_[hidden])
Date: 2010-03-10 06:38:19


Hello all,

the documentation describes that Boost.Array deliberately omits constructors
to allow intialisation in functions:

void F()
{
   boost::array<int, 4> a2 = { 1, 2, 3 };
}

That's fine, but how does one intialise a Boost.Array in member intialiser
list, e.g.:

struct Foo
{
   Foo()
    : m_a(???)
   {
   }

   boost::array<int, 4> m_a;
};

Ofc initialisation can be done in the body of the constructor, but this does
not work for const member variables. Also above design choice is
contradictionary with STL containers, which gets default initialised. (e.g. m_v
(3); ofc there is a difference, since vectors have a dynamic size).

thx in advance


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