Boost logo

Boost Users :

From: LoadCom (LoadCom_at_[hidden])
Date: 2007-08-06 20:34:16


Thanks. It's quite clear to me now.

Max

LoadCom <LoadCom <at> sina.com> writes:

> Thanks that works.
> ?
> Buy why that works?
> ?
> Max
>
> On 8/5/07, "JOAQUIN LOPEZ MU?Z" <joaquin <at> tid.es>
> wrote:
> > Use an added level of brace enclosing:
> > {{
> > {"Chun", "Wang", 1441},
> > {"Chia", "Wang", 1443},
> > {"Ta", "Wang", 1445}
> > }};
[...]

boost::array<T,N> is an agregate class (which means
you can initialize it with a brace-enclosed list)
containing a member

  T elems[N];

which is in turn an aggregate. So, if you've got a
boost::array<People,3>, the list

  {
    {"Chun", "Wang", 1441},
    ...
  }

is apt to initialize elems, and for initializing the
boost::array you've got to add another level of {}:

  {{
    {"Chun", "Wang", 1441},
    ...
  }}

although the standard allows the omission of the outer
level under some circumnstances, as noted in

http://boost.org/doc/html/array/rationale.html

Hope it's clearer now. Best,

Joaqu¨ªn M L¨®pez Mu?oz
Telef¨®nica, Investigaci¨®n y Desarrollo


_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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