digitalmars.D.learn - Allocate an Array!T on the heap?
- Tobias Pankrath (13/13) Jun 21 2012 import std.container;
- Timon Gehr (7/20) Jun 22 2012 This seems to work:
- Tobias Pankrath (2/30) Jun 22 2012 Thanks.
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 !()()
Jun 21 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); }
Jun 22 2012
On Friday, 22 June 2012 at 10:19:13 UTC, Timon Gehr wrote:On 06/22/2012 08:45 AM, Tobias Pankrath wrote:Thanks.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); }
Jun 22 2012