Problem Benchmarking HashSet from containers-em

Justin Whear via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 22 12:46:57 PDT 2015


On Thu, 22 Oct 2015 19:41:08 +0000, Nordlöw wrote:

> 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.

The HashSet defines different constructors based on the nature of tha allocator:
https://github.com/economicmodeling/containers/blob/master/src/containers/hashset.d#L30

Specifically, if the allocator has zero state (like Mallocator), you do not pass an instance.  If the allocator does have state, like InSituRegion, you need to pass an instance to the container's constructor.


More information about the Digitalmars-d-learn mailing list