Re: how hash_t toHash() works?

2013-05-04 Thread gedaiu
On Tuesday, 30 April 2013 at 17:48:08 UTC, Ivan Kazmenko wrote: - import std.functional; ... RedBlackTree !(MyRecord, binaryFun!a.key b.key, true) cont; ... cont = redBlackTree !(a.key b.key, true, MyRecord) (); - Error: template instance RedBlackTree!(ValueRecord,

Re: how hash_t toHash() works?

2013-05-04 Thread Ivan Kazmenko
One more question... why associative arrays in D can't be implemented like here? http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_hash.h?view=markup it seems that php arrays uses hash tables too but they preserve orders. From what I see there, this code traverses a hash table in the

Re: how hash_t toHash() works?

2013-04-30 Thread gedaiu
On Monday, 29 April 2013 at 16:01:15 UTC, Ivan Kazmenko wrote: one more question What is the type of cont? auto cont = redBlackTree !(a.key b.key, true, MyRecord) (); I want to use this as a property in a class and i can't use there auto keyword... I tried different types but it did not

Re: how hash_t toHash() works?

2013-04-30 Thread Ivan Kazmenko
- import std.functional; ... RedBlackTree !(MyRecord, binaryFun!a.key b.key, true) cont; ... cont = redBlackTree !(a.key b.key, true, MyRecord) (); - Error: template instance RedBlackTree!(ValueRecord, binaryFun, true) RedBlackTree!(ValueRecord, binaryFun, true) does not

Re: how hash_t toHash() works?

2013-04-29 Thread gedaiu
On Sunday, 28 April 2013 at 13:18:04 UTC, Ivan Kazmenko wrote: Hi, I have a class which I want to use as key in an assoc array like this: string[KeyString] myArray; What i want is to preserve the order in the array. I want always to have 1 before 2 if the string is a numeric value. Can

Re: how hash_t toHash() works?

2013-04-29 Thread Ivan Kazmenko
one more question What is the type of cont? auto cont = redBlackTree !(a.key b.key, true, MyRecord) (); I want to use this as a property in a class and i can't use there auto keyword... I tried different types but it did not work. For me, the following declaration works: - import

how hash_t toHash() works?

2013-04-28 Thread gedaiu
hi, I have a class which I want to use as key in an assoc array like this: string[KeyString] myArray; What i want is to preserve the order in the array. I want always to have 1 before 2 if the string is a numeric value. Can anyone help me to understand how const hash_t toHash() should work?

Re: how hash_t toHash() works?

2013-04-28 Thread Ivan Kazmenko
Hi, I have a class which I want to use as key in an assoc array like this: string[KeyString] myArray; What i want is to preserve the order in the array. I want always to have 1 before 2 if the string is a numeric value. Can anyone help me to understand how const hash_t toHash() should