Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
March 30, 2013 [Issue 9839] New: std.traits.Select to alias variables too | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9839 Summary: std.traits.Select to alias variables too Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2013-03-30 13:05:07 PDT --- Currently Select can't be used with variable names: import std.traits: Select; void main() { uint[] a1; ulong[] a2; alias T = int; alias T1 = Select!(T.sizeof == uint.sizeof, uint, ulong); alias a = Select!(is(T1 == uint), a1, a2); } DMD 2.063alpha: temp.d(7): Error: template instance Select!(true, a1, a2) Select!(true, a1, a2) does not match template declaration Select(bool condition, T, F) So I suggest to add an alias version of Select (in future when built-in types will become alias-able, the Select without alias will be removed): template Select(bool b, alias A1, alias A2) { static if (b) alias Select = A1; else alias Select = A2; } template Select(bool b, T1, T2) { static if (b) alias Select = T1; else alias Select = T2; } void main() { uint[] a1; ulong[] a2; alias T = int; alias T1 = Select!(T.sizeof == uint.sizeof, uint, ulong); alias a = Select!(is(T1 == uint), a1, a2); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 31, 2013 [Issue 9839] std.traits.Select should be able to select symbols | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=9839 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull Summary|std.traits.Select to alias |std.traits.Select should be |variables too |able to select symbols --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-31 04:06:46 PDT --- https://github.com/D-Programming-Language/phobos/pull/1235 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 31, 2013 [Issue 9839] std.traits.Select should be able to select symbols | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=9839 --- Comment #2 from github-bugzilla@puremagic.com 2013-03-31 05:58:56 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/320b73a39d3950651c034a142b70d93b36a9ecb1 Fixes Issue 9839 - Select should be able to select symbols. https://github.com/D-Programming-Language/phobos/commit/39dd56dc551248917c093838ab43fdaf34a5501d Merge pull request #1235 from AndrejMitrovic/Fix9839 Issue 9839 - Select should be able to select symbols. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 31, 2013 [Issue 9839] std.traits.Select should be able to select symbols | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=9839 Kenji Hara <k.hara.pg@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: ------- |
Copyright © 1999-2021 by the D Language Foundation