Hello Denis,

Hmm.. Not a common case, but looks like a bug. Or a clever design
decision :P

Certainly, you can create an int using new:

int* i = new int;

Why can't you create 'char[]'?

T create(T) {
return new T;
}
int* i = create!(int); // fine
char[]* c = create!(char[]); // error

that should be:
T* create(T)() {
return new T;
}

but works (or not) as you said

OTOH this works:

T* create(T)() {
T[] ret = new T[1];
return &ret[0];
}

void main()
{
int* i = create!(int); // fine
char[]* c = create!(char[]); // error
}


Reply via email to