[Issue 8799] Give example of Tuple mapped to a function
https://issues.dlang.org/show_bug.cgi?id=8799 --- Comment #7 from github-bugzi...@puremagic.com --- Commits pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/e0ca51f9f01cc2a089907b09f9e0ed3dd15df643 fix issue 8799 https://github.com/dlang/phobos/commit/c77869f22e61919a9f3d617d7d5d2254641aa7e4 Merge pull request #4882 from somzzz/issue_8799 --
[Issue 8799] Give example of Tuple mapped to a function
https://issues.dlang.org/show_bug.cgi?id=8799 --- Comment #6 from github-bugzi...@puremagic.com --- Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/e0ca51f9f01cc2a089907b09f9e0ed3dd15df643 fix issue 8799 https://github.com/dlang/phobos/commit/c77869f22e61919a9f3d617d7d5d2254641aa7e4 Merge pull request #4882 from somzzz/issue_8799 --
[Issue 8799] Give example of Tuple mapped to a function
https://issues.dlang.org/show_bug.cgi?id=8799 --- Comment #5 from github-bugzi...@puremagic.com --- Commits pushed to scope at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/e0ca51f9f01cc2a089907b09f9e0ed3dd15df643 fix issue 8799 https://github.com/dlang/phobos/commit/c77869f22e61919a9f3d617d7d5d2254641aa7e4 Merge pull request #4882 from somzzz/issue_8799 --
[Issue 8799] Give example of Tuple mapped to a function
https://issues.dlang.org/show_bug.cgi?id=8799 --- Comment #4 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/e0ca51f9f01cc2a089907b09f9e0ed3dd15df643 fix issue 8799 https://github.com/dlang/phobos/commit/c77869f22e61919a9f3d617d7d5d2254641aa7e4 Merge pull request #4882 from somzzz/issue_8799 fix issue 8799 --
[Issue 8799] Give example of Tuple mapped to a function
https://issues.dlang.org/show_bug.cgi?id=8799 --- Comment #3 from Lucia Cojocaru--- pull https://github.com/dlang/phobos/pull/4882 --
[Issue 8799] Give example of Tuple mapped to a function
https://issues.dlang.org/show_bug.cgi?id=8799 Andrei Alexandrescuchanged: What|Removed |Added Assignee|nob...@puremagic.com|lucia.mcojoc...@gmail.com --
[Issue 8799] Give example of Tuple mapped to a function
https://issues.dlang.org/show_bug.cgi?id=8799 Andrei Alexandrescuchanged: What|Removed |Added Keywords||bootcamp CC||and...@erdani.com Blocks||16614 --
[Issue 8799] Give example of Tuple mapped to a function
https://issues.dlang.org/show_bug.cgi?id=8799 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added CC||andrej.mitrov...@gmail.com --- Comment #2 from Andrej Mitrovic andrej.mitrov...@gmail.com --- (In reply to Jesse Phillips from comment #1) Sorry I miss understood and did not remember that Tuples do auto expand. The actual request is mapping the Tuple to a function, as requested on SO: http://stackoverflow.com/questions/12888263/mapping-variadic-template- arguments-in-d The following is an updated example. However, the problem is this feature isn't really supported, it just happens to work. There's no telling whether it will break at some point, so I think we shouldn't document it yet. - /** Return a Tuple expression of $(D Func) being applied to every tuple argument. */ template Map(alias Func, args...) { static auto ref ArgCall(alias Func, alias arg)() { return Func(arg); } static if (args.length 1) alias Map = TypeTuple!(ArgCall!(Func, args[0]), Map!(Func, args[1 .. $])); else alias Map = ArgCall!(Func, args[0]); } /// unittest { import std.conv; int square(int arg) { return arg * arg; } int refSquare(ref int arg) { arg *= arg; return arg; } ref int refRetSquare(ref int arg) { arg *= arg; return arg; } void test(int a, int b) { assert(a == 4, a.text); assert(b == 16, b.text); } void testRef(ref int a, ref int b) { assert(a++ == 16, a.text); assert(b++ == 256, b.text); } int a = 2; int b = 4; test(Map!(square, a, b)); test(Map!(refSquare, a, b)); assert(a == 4); assert(b == 16); testRef(Map!(refRetSquare, a, b)); assert(a == 17); assert(b == 257); } - --
[Issue 8799] Give example of Tuple mapped to a function
http://d.puremagic.com/issues/show_bug.cgi?id=8799 --- Comment #1 from Jesse Phillips jesse.k.phillip...@gmail.com 2012-10-19 11:28:57 PDT --- Sorry I miss understood and did not remember that Tuples do auto expand. The actual request is mapping the Tuple to a function, as requested on SO: http://stackoverflow.com/questions/12888263/mapping-variadic-template-arguments-in-d -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---