Allocate an Array!T on the heap?
Timon Gehr
timon.gehr at gmx.ch
Fri Jun 22 03:19:12 PDT 2012
On 06/22/2012 08:45 AM, Tobias Pankrath wrote:
> import std.container;
>
> struct A {};
>
> void main()
> {
> Array!(A)* arr = new Array!(A);
> }
>
> yields
>
>
> bug.d(7): Error: template std.container.Array!(A).Array.__ctor does not
> match any function template declaration
> /usr/include/d/std/container.d(1625): Error: template
> std.container.Array!(A).Array.__ctor(U) if
> (isImplicitlyConvertible!(U,T)) cannot deduce template function from
> argument types !()()
>
This seems to work:
import std.container;
struct A {};
void main() {
auto arr = new Array!A(A.init);
}
More information about the Digitalmars-d-learn
mailing list