Boost logo

Boost :

From: Vincent Bhérer-Roy (vbr.boost_at_[hidden])
Date: 2006-05-25 09:37:56

On 25-May-06, at 06:39, Thorsten Ottosen wrote:
> What is it specifically your are looking for?
I'm basically looking for a way to initialize a Boost.Array. However,
for me, the problem with this is larger, I want this class to be
useful directly (without using another lib), safely (always
initialized) and in the same way we use usual classes. I don't care
about aggregates, as you can partially construct the object and
officially only give compile time values. However I understand that
some people like it and it is why I searched for a solution that let
people use Boost.Array as an aggregate. But looking at old
discussions, I pretty sure I'm not the only one who would like normal
constructs for their arrays.

> Maybe Boost.Assign can help you:
Ok, I was not aware that Boost.Assign works with Boost.Array sorry.
This is good news and can help me thanks.

However, I really prefer my solution. I think it is not to much
invasive and it gives the user the usual construction syntax, which I
think is something highly desirable. It gives an array concept closer
to the STL container concept, by making array elements always
initialized. And this without bugging too much those who wants to
keep the Boost.Array as an aggregate.

Also, it will gives compile time errors for things like that:

array<int,4> a = list_of(1)(2)(3).to_array( a ); // compiles fine
array<int,4, true> a(1,2,3); // doesn't compile
array<int,4, true> a(1); // compile fine and repeats the value
array<int,4, true> a(1,2,3,4); // compiles fine

So, yes Boost.Assign can help, but no it is not what I was looking
for ;-)


Boost list run by bdawes at, gregod at, cpdaniel at, john at