[Issue 7356] New: Implement KeyType, ValueType for hashes in std.traits
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 23 22:50:36 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7356
Summary: Implement KeyType, ValueType for hashes in std.traits
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-01-23 22:50:34 PST ---
I've had a use-case for these but they were not in std.traits, so here's an
implementation:
import std.traits;
template KeyType(AA)
if (isAssociativeArray!AA)
{
static if (is(AA V : V[K], K))
{
alias K KeyType;
}
}
template ValueType(AA)
if (isAssociativeArray!AA)
{
static if (is(AA V : V[U], U))
{
alias V ValueType;
}
}
If I get an OK I can make a pull for this (with documentation).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list