Created
March 29, 2022 15:19
-
-
Save pbackus/afb4b8a3a1b915fc4556bccd20914eb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// map over a variadic argument list | |
template mapArgs(alias fun) | |
{ | |
auto mapArgs(Args...)(auto ref Args args) | |
{ | |
import std.typecons: tuple; | |
import core.lifetime: forward; | |
import std.meta: Map = staticMap; | |
auto ref mapArg(alias arg)() | |
{ | |
return fun(forward!arg); | |
} | |
return tuple(Map!(mapArg, args)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment