Boost logo

Boost :

Subject: Re: [boost] Is there a thin array wrapper/proxy lying around somewhere?
From: Jonathan Wakely (jwakely.boost_at_[hidden])
Date: 2013-11-29 10:17:28


On 29 November 2013 14:12, Daryle Walker wrote:
> For C++11, array members can finally be put in member-initializers.

Array members were always allowed in member-initializers.

> But brace-
> initialization must be used,

No, you can value-initialize them with () too.

> and they're still not Assignable:
>
> Foo( int p1, Arr3 const &p2, long p3 ) : m1( p1 ), m2{}, m3{ p3 }
> { std::copy(std::begin(p2), std::end(p2), std::begin(m2)); }
>
> (The "m2" member initialization could have been omitted since the body completely
> paves those values over.)

That's why I omitted it :-)

>>
>> Another option is just to provide a wrapper around std::array that
>> offers the implicit conversion to pointer.
>
> The aggressive array-to-pointer decay makes arrays 2nd-class types in the C family
> of languages and is our (not so) secret shame. A design that needs to emulate
> this decay is probably broken.

Yes, but that's what the OP specifically asked for.


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