www.digitalmars.com         C & C++   DMDScript  

c++.beta - aggregate initializer

struct A
{
  A()
  { }

  A(int)
  { }
};

struct B
{
  A a[2];
  // if I omit the default constructor for A (A::A() above), I get an
  // additional error here:
  // Error: cannot find constructor for class matching A::A()s
};

int main()
{
  B b = {{1, 2}};
  // Error: expression expected
}


Boost's array tests rely on it.


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Jun 14 2003