On 2011-08-24 11:17:08 +0000, "Steven Schveighoffer"
<schvei...@yahoo.com> said:
It's actually possible, but ugly:
auto ptr = (new int[10][](1)).ptr;
One really interesting thing to note -- the compiler actually turns
struct allocations into array-of-one allocations in the runtime. So
this is likely what the compiler would do if it supported direct heap
allocation of fixed-sized arrays.
A problem with this approach is that it won't work in safe mode because
accessing the .ptr property of an array is unsafe in general. But it is
perfectly safe to allocate a static array on the GC heap, so it should
be allowed…
--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/