I'm just confused about how static while is supposed to work
because static foreach, to my understanding, would have to work
by making a new type for each iteration. I say this because, 1)
runtime foreach works like that (with type = range), and 2)
without ctfe foreach, the only way I know of
On Tue, Jul 22, 2014 at 03:52:14PM +, Vlad Levenfeld via
Digitalmars-d-learn wrote:
I'm just confused about how static while is supposed to work because
static foreach, to my understanding, would have to work by making a
new type for each iteration. I say this because, 1) runtime foreach
On Tuesday, 22 July 2014 at 16:42:14 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Tue, Jul 22, 2014 at 03:52:14PM +, Vlad Levenfeld via
Digitalmars-d-learn wrote:
Anyway my actual question is: if all values are constant at
compile
time, how would a static while loop terminate?
Yes, though the loop unrolling is news to me. I'll have to keep
that in mind next time I'm trying to squeeze some extra
performance out of a loop.
btw, found a static switch enhancement request here:
https://issues.dlang.org/show_bug.cgi?id=6921
Thats real weird that it would reject your i variable, given
that T.length is known at compile time. I think this is a bug. I
can get your code to compile if I change your foreach loop to
this:
foreach(i, U; T)
modTuple[i] = transTupleElem(argTuple[i]); // ok
On Monday, 21 July 2014 at 01:29:40 UTC, Daniel Gibson wrote:
Am 21.07.2014 03:05, schrieb Vlad Levenfeld:
Thats real weird that it would reject your i variable, given
that
T.length is known at compile time. I think this is a bug. I
can get your
code to compile if I change your foreach loop
On Monday, 21 July 2014 at 15:04:14 UTC, TheFlyingFiddle wrote:
//Outputs 1 to 10 at compile-time.
Edit: 0 to 9
Am 21.07.2014 17:04, schrieb TheFlyingFiddle:
On Monday, 21 July 2014 at 01:42:58 UTC, Daniel Gibson wrote:
Am 21.07.2014 03:34, schrieb Vlad Levenfeld:
To get a foreach to run at compile-time, you have to give it something
whose value is known to the compiler (so, T and typeof(argTuple) would
On Mon, Jul 21, 2014 at 12:55:34AM +0200, Daniel Gibson via Digitalmars-d-learn
wrote:
Hi,
I have a variadic templated function and want to call a C varargs function.
I want to be able to pass static arrays, which D2 passes by value and C by
reference, so I'd like to automagically translate
On Mon, Jul 21, 2014 at 06:36:04PM +0200, Daniel Gibson via Digitalmars-d-learn
wrote:
[...]
However, having something like staticIota in the stdlib would probably
make sense.
[...]
It's already in std.typecons.
(Admittedly, that's not exactly the most obvious place to look for it...)
T
--
H. S. Teoh:
It's already in std.typecons.
But it is not online yet?
Bye,
bearophile
Am 21.07.2014 20:09, schrieb H. S. Teoh via Digitalmars-d-learn:
On Mon, Jul 21, 2014 at 06:36:04PM +0200, Daniel Gibson via Digitalmars-d-learn
wrote:
[...]
However, having something like staticIota in the stdlib would probably
make sense.
[...]
It's already in std.typecons.
(Admittedly,
On Monday, 21 July 2014 at 18:10:14 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Mon, Jul 21, 2014 at 12:55:34AM +0200, Daniel Gibson via
Digitalmars-d-learn wrote:
Hi,
I have a variadic templated function and want to call a C
varargs function.
I want to be able to pass static arrays,
On Monday, 21 July 2014 at 19:02:59 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
functionality is desirable. Maybe we should rouse a racket on
the main D
forum to either make staticIota public, or implement static
foreach. ;-)
static switch would be so sick. I frequently find myself doing
On Tue, Jul 22, 2014 at 02:47:51AM +, Vlad Levenfeld via
Digitalmars-d-learn wrote:
On Monday, 21 July 2014 at 19:02:59 UTC, H. S. Teoh via Digitalmars-d-learn
wrote:
functionality is desirable. Maybe we should rouse a racket on the
main D forum to either make staticIota public, or
15 matches
Mail list logo