On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote:
Hi,
I am currently trying to create a function
makeMultidimensionalArray which allocates memory for a
multidimensional array.
You were very close to the answer:
auto makeMultidimensionalArray(int N, T, Allocator)(auto ref
Al
On Thursday, 12 January 2017 at 00:30:33 UTC, Ignacious wrote:
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu
wrote:
[...]
If you change the return type to a void* your code basically
works.
void* makeMultidimensionalArray(T, Allocator)(auto ref
Allocator alloc, size_t[] leng
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote:
Hi,
I am currently trying to create a function
makeMultidimensionalArray which allocates memory for a
multidimensional array. It is very similar with [1],
the difference being that it is uninitialized. Here is the code:
auto m
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote:
Hi,
I am currently trying to create a function
makeMultidimensionalArray which allocates memory for a
multidimensional array. It is very similar with [1],
the difference being that it is uninitialized. Here is the code:
auto m
On Wednesday, 11 January 2017 at 19:39:17 UTC, Ali Çehreli wrote:
return choose(lengths.length == 1, one!T(alloc,
lengths[0]), two!T(alloc, lengths));
Well, choose is the right tool when the choice can only be made
at runtime. That would be uncommon for dimensionality.
Anyhow mentioning
On Wednesday, 11 January 2017 at 19:30:05 UTC, Stefan Koch wrote:
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu
wrote:
Hi,
I am currently trying to create a function
makeMultidimensionalArray which allocates memory for a
multidimensional array. It is very similar with [1],
the di
On 01/11/2017 11:30 AM, Stefan Koch wrote:
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote:
Hi,
I am currently trying to create a function makeMultidimensionalArray
which allocates memory for a multidimensional array. It is very
similar with [1],
the difference being that it is
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote:
auto makeMultidimensionalArray(T, Allocator)(auto ref Allocator
alloc, size_t[] lengths)
{
if (lengths.length == 1)
Looks like `static if` would fix your specific problem.
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote:
Hi,
I am currently trying to create a function
makeMultidimensionalArray which allocates memory for a
multidimensional array. It is very similar with [1],
the difference being that it is uninitialized. Here is the code:
[...]
Hi,
I am currently trying to create a function
makeMultidimensionalArray which allocates memory for a
multidimensional array. It is very similar with [1],
the difference being that it is uninitialized. Here is the code:
auto makeMultidimensionalArray(T, Allocator)(auto ref Allocator
alloc, s
10 matches
Mail list logo