std.experimental.alloctor does not work with non default constructible types

maik klein via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 3 05:24:17 PDT 2016


On Friday, 3 June 2016 at 12:16:54 UTC, Andrei Alexandrescu wrote:
> On 6/3/16 7:57 AM, maik klein wrote:
>> On Friday, 3 June 2016 at 11:52:52 UTC, Andrei Alexandrescu 
>> wrote:
>>> On 6/3/16 7:47 AM, maik klein wrote:
>>>> [...]
>>>
>>> Looks like a bug. Do you have a short repro? -- Andrei
>>
>> import std.experimental.allocator;
>> struct Foo{
>>      @disable this();
>> }
>> auto foos = theAllocator.makeArray!Foo(100);
>>
>> Error messsage:
>>
>> ../../.dub/packages/experimental_allocator-2.70.0-b1/src/std/experimental/allocator/package.d(576,34):
>> Error: variable
>> std.experimental.allocator.uninitializedFillDefault!(Foo).uninitializedFillDefault.t
>> default construction is disabled for type immutable(Foo)
>> ../../.dub/packages/experimental_allocator-2.70.0-b1/src/std/experimental/allocator/package.d(612,36):
>> Error: template instance
>> std.experimental.allocator.uninitializedFillDefault!(Foo) error
>> instantiating
>> source/breeze/util/algebraic.d(91,43):        instantiated 
>> from here:
>> makeArray!(Foo, IAllocator)
>
> That should be fixable, please submit to bugzilla. Thanks! -- 
> Andrei

Thanks, I opened an issue here 
https://issues.dlang.org/show_bug.cgi?id=16117

I just used makeArray because it was just so convenient to use 
but I guess I could also switch to the untyped interface if this 
proves to be a blocker.



More information about the Digitalmars-d mailing list