Problem Benchmarking HashSet from containers-em
Nordlöw via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Oct 22 12:41:08 PDT 2015
On Thursday, 22 October 2015 at 17:32:34 UTC, Justin Whear wrote:
> On Thu, 22 Oct 2015 11:55:37 +0000, Nordlöw wrote:
>
>> What's wrong?
>
> HashSet has a disabled default constructor; you need to supply
> the allocator instance to the constructor here
> https://github.com/nordlow/
> justd/blob/master/containers_ex.d#L17
Doesn't work.
If I change
auto set = HashSet!(E, Allocator)();
to
auto set = HashSet!(E, Allocator)(Allocator());
it errors as
containers_ex.d(17,38): Error: constructor
containers.hashset.HashSet!(const(int), Mallocator, generateHash,
false).HashSet.this (ulong bucketCount) is not callable using
argument types (Mallocator)
containers_ex.d(30,16): Error: template instance
containers_ex.hashSet!(Mallocator, const(int)[]) error
instantiating
containers_ex.d(35,5): Error: static assert (is(typeof(__error)
== const(int)*)) is false
My existing call to
auto set = HashSet!(E, Allocator)();
works for Mallocator as in
https://github.com/nordlow/justd/blob/master/containers_ex.d#L17
but not for
InSituRegion!(1024*1024, T.alignof)
Why? Please, help.
More information about the Digitalmars-d-learn
mailing list