|
Boost Users : |
Subject: Re: [Boost-users] Boost.Array intialisation
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-03-10 07:36:40
Or use boost assign as shown inline below. Though I'm not sure of the
performance differences.
Roman Perepelitsa wrote:
> 2010/3/10 gast128 <gast128_at_[hidden] <mailto:gast128_at_[hidden]>>
>
> That's fine, but how does one intialise a Boost.Array in member
> intialiser
> list
>
> boost::array<int, 4> MakeArray()
> {
> boost::array<int, 4> res = { 1, 2, 3, 4 };
> return res;
> }
#include <boost/assign/list_of.hpp>
#include <boost/array.hpp>
using namespace boost::assign;
> struct Foo
> {
> Foo() : m_a(MakeArray()) {}
Foo() : m_a(list_of(1)(2)(3)(4)) {}
> boost::array<int, 4> m_a;
> };
>
> Roman Perepelitsa.
Jeff
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