digitalmars.D.bugs - [Issue 4736] New: http://www.digitalmars.com/d/2.0/hash-map.html
- d-bugmail puremagic.com (59/59) Aug 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4736
- d-bugmail puremagic.com (6/6) Jan 04 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4736
- d-bugmail puremagic.com (9/9) Jan 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4736
http://d.puremagic.com/issues/show_bug.cgi?id=4736
Summary: http://www.digitalmars.com/d/2.0/hash-map.html
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: andrej.mitrovich gmail.com
14:27:13 PDT ---
Example under "Using Classes as the KeyType" has some typos (f instead of foo),
fix to:
class Foo
{
int a, b;
hash_t toHash() { return a + b; }
bool opEquals(Object o)
{
Foo foo = cast(Foo) o;
return foo && a == foo.a && b == foo.b;
}
int opCmp(Object o)
{
Foo foo = cast(Foo) o;
if (!foo)
return -1;
if (a == foo.a)
return b - foo.b;
return a - foo.a;
}
}
Example under "Using Structs or Unions as the KeyType" has a typo (s instead of
str) fix to:
import std.string;
struct MyString
{
string str;
const hash_t toHash()
{
hash_t hash;
foreach (char c; str)
hash = (hash * 9) + c;
return hash;
}
const bool opEquals(ref const MyString s)
{
return std.string.cmp(this.str, s.str) == 0;
}
const int opCmp(ref const MyString s)
{
return std.string.cmp(this.str, s.str);
}
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4736 07:41:52 PST --- https://github.com/D-Programming-Language/d-programming-language.org/pull/51 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 04 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4736
Andrej Mitrovic <andrej.mitrovich gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 18 2012









d-bugmail puremagic.com 