Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2006-08-09 09:22:06


Sylvain Pion <Sylvain.Pion <at> sophia.inria.fr> writes:

>
> Jeff Flinn wrote:
> > Would not the boost.assign library work here?
> >
> >>>class A {
> >>> boost::array<int, 3> a;
> >>> A() : a(boost::assign::list_of(1)(2)(3)(4)) {}
> >>>};
> >
> > I don't think I've tried it this way yet.
>
> It works, but it's not efficient. It is even incredibly worse that
> doing the assignments by hand (boost 1.33.1 is better than 1.32 though).
> See my attached test program. Here is what I get (with g++ 4.1):
>

Try throwing this into the mix:

  a(boost::assign::cref_list_of<3>(1)(2)(3))

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk