|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2003-08-08 13:36:33
>Robert Ramey wrote:
>> Currently boost array contains a copy of the array that initialized it.
>> Is there any reason that boost array can't be enhanced to contain a reference
>> to the original C array? I think this would make it more useful
>> to me as well as others.
>AlisdairM wrote
>I don't see the problem. boost::array is not a wrapper around an
>existing array, it IS an array. In the same way, std::vector does not
>take ownership of any existing memory you may want to initialise it
>with.
The problem is that boost::array is not a wrapper around an
existing array, it IS an array. This implys making a superfluous
copy of the array in some cases.
Given an simple C array, I want a wrapper which will supply an
iterator interface so that I can do something like.
const in array{] = {1, 2, 3, 4};
boost::array<int> ba(array);
std::copy(ba.begin(), ba.end(), std_ostream_iterator<int>(std::cout));
Is there already a way to do this? Or is there some reason why
one would never want to do this?
>I am not sure what you are trying to achieve, why do scoped_array or
>shared_array not serve in this case?
Hmmm - I didn't find shared_array nor scoped_array in my documenation
until you mentioned it. Perhaps it should be added to the index at a higher level.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk