On 11/29/2014 3:59 PM, Ali Çehreli wrote:
[...]
typeid() is a runtime function. I think it will be costly every time
toHash is called. The function pointer can be initialized once.
// I've "deduced" the type from an error message. ;)
static const ulong delegate(const(void*)) const pure
On 11/29/2014 12:45 PM, David Held wrote:
> On 11/26/2014 4:40 PM, Ali Çehreli wrote:
>> [...]
>> override
>> size_t toHash() @trusted pure const nothrow
>> {
>> auto func = assumePure(&(typeid(importantStuff).getHash));
>> return func(&importantStuff);
>> }
On 11/26/2014 4:40 PM, Ali Çehreli wrote:
[...]
override
size_t toHash() @trusted pure const nothrow
{
auto func = assumePure(&(typeid(importantStuff).getHash));
return func(&importantStuff);
}
Very helpful, thanks! Am I right in assuming that there is som
On 11/26/2014 04:25 PM, David Held wrote:
> class Foo
> {
> override
> size_t toHash() @trusted pure const nothrow
> {
> // error: no property 'toHash' for type 'int[]'
> return importantStuff.toHash();
> }
The getHash() member function of the particular Typ
I have a class which contains an int[] and some other stuff. I want to
use my class as the key for an AA, so I am overriding toHash(). But the
int[] is the only part which should produce the hash code. I know that
int[].toHash() is defined somehow, because I can put int[] directly into
an AA