Boost logo

Boost :

Subject: Re: [boost] [array] array_cast helper function
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-15 10:51:48


herve martin wrote:
> For some reason reference on C array is almost never used by developers even
> if a reference on C array encapsulates more information than just a pointer
> on the 1st element. A striking example is that the dynamic allocation of an
> array using the new syntax returns a pointer on first element ( int *ptr =
> new int[10]; ) although I would expect getting a pointer on an array ( int
> (*ptr)[10] = new int[10]; - this syntax fails but is more conform to what we
> could expect, even if I must admit that the second syntax is not really
> intuitive -).

new[] has to return a pointer because the size doesn't
have to be known at compile time.

In Christ,
Steven Watanabe

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