I'd like to have foreach and inline if in templates:
The tIf doesn't work properly but I'm not sure why
template tuple(args...) { alias tuple = args; }
template tIf(bool cond) { alias tIf = tuple!(); }
template tIf(bool cond, alias T)
{
static if (cond) alias tIF = T; else alias tIF =
BTW, it works with static if's, I'm trying to use an inline if to
reduce redundant code since there is no static ?:.
On Saturday, 27 July 2013 at 17:15:54 UTC, JS wrote:
BTW, it works with static if's, I'm trying to use an inline if
to reduce redundant code since there is no static ?:.
I don't really understand, since you didn't really explain *what*
you were trying to do before pasting that code, but fo
On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote:
The tIf doesn't work properly but I'm not sure why
[...]
template tIf(bool cond, alias T)
Lower case 'f' here, ...
{
static if (cond) alias tIF = T; else alias tIF = tuple!();
... upper case 'F's here.
On Saturday, 27 July 2013 at 19:06:48 UTC, anonymous wrote:
On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote:
The tIf doesn't work properly but I'm not sure why
[...]
template tIf(bool cond, alias T)
Lower case 'f' here, ...
{
static if (cond) alias tIF = T; else alias tIF = tup
On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote:
I'd like to have foreach and inline if in templates:
inline if is available as std.traits.Select
On Sunday, 28 July 2013 at 08:38:01 UTC, JS wrote:
On Sunday, 28 July 2013 at 08:30:17 UTC, QAston wrote:
On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote:
I'd like to have foreach and inline if in templates:
inline if is available as std.traits.Select
This doesn't work for variadic args
On Sunday, 28 July 2013 at 08:30:17 UTC, QAston wrote:
On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote:
I'd like to have foreach and inline if in templates:
inline if is available as std.traits.Select
This doesn't work for variadic args...
Something Split!(Cond, targ..., split, fargs) i
The following works but is somewhat of a hack...
module main;
import std.stdio, std.typetuple;
struct tTupleSplit
{
}
template tIndexOf(T, args...)
{
static if (staticIndexOf!(T, args) < 0) enum tIndexOf =
args.length;
else enum tIndexOf = staticIndexOf!(T, args);
}
template tMin(a
On Sunday, 28 July 2013 at 08:38:40 UTC, JS wrote:
On Sunday, 28 July 2013 at 08:38:01 UTC, JS wrote:
On Sunday, 28 July 2013 at 08:30:17 UTC, QAston wrote:
On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote:
I'd like to have foreach and inline if in templates:
inline if is available as std
On Sunday, 28 July 2013 at 09:11:55 UTC, anonymous wrote:
On Sunday, 28 July 2013 at 08:38:40 UTC, JS wrote:
On Sunday, 28 July 2013 at 08:38:01 UTC, JS wrote:
On Sunday, 28 July 2013 at 08:30:17 UTC, QAston wrote:
On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote:
I'd like to have foreach
On Sunday, 28 July 2013 at 15:33:48 UTC, JS wrote:
I tried to do that with tuple which is identical to your wrap
but was not successful... possibly because I did not unwrap
it...
It should work. You can expand the *types* with Types, and the
*values* with expand.
On Sunday, 28 July 2013 at 15:33:48 UTC, JS wrote:
On Sunday, 28 July 2013 at 09:11:55 UTC, anonymous wrote:
On Sunday, 28 July 2013 at 08:38:40 UTC, JS wrote:
[...]
template Wrap(Stuff ...) {alias unwrap = Stuff;}
Select!(cond, Wrap!targs, Wrap!fargs).unwrap
I tried to do that with tuple wh
13 matches
Mail list logo