Boost logo

Boost :

Subject: Re: [boost] [array] change proposal for the c_array() function
From: herve martin (hervemart1_at_[hidden])
Date: 2009-03-15 08:24:47


Niels Dekker wrote:

> herve martin wrote:
>
>> I would submit a simple change request in the boost::array library.
>>
> ...
>
>> I suggest to change:
>> T* c_array() { return elems; }
>>
>> into
>> T (&c_array())[N] { return *(T(*)[N]) elems; }
>>
>
> Believe it or not, I was considering to submit the very same feature
> request. But go ahead: https://svn.boost.org/trac/boost/newticket (Please
> consider requesting a const overload as well!)
>

maybe I'm wrong but I don't think that we need the const overload since a
T(&)[N] is implicitly convertible into a const T(&)[N] so
{ const int (&toto)[10] = (new boost::array<int,10>)->c_array() } should
work.

best regards, herve


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