On Thursday, 29 September 2016 at 22:03:36 UTC, ag0aep6g wrote:
On 09/29/2016 11:28 PM, Ilya Yaroshenko wrote:
[...]
[...]
[...]
When the values themselves are known at compile time, we can
convert them to size_t before generating the function:
enum isIndex(T) = is(T == size_t); /*
On 09/29/2016 11:28 PM, Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 20:57:00 UTC, ag0aep6g wrote:
[...]
void foo(size_t n)(size_t[n] a ...) { /* ... */ }
Just found an example, where this approach does not work :-(
template transposed(Dimensions...)
if (Dimensions.length)
{
On Thursday, 29 September 2016 at 21:31:11 UTC, Timothee Cour
wrote:
maybe remove the corresponding DIP from
https://github.com/libmir/mir/wiki/Compiler-and-druntime-bugs#dips ?
On Thu, Sep 29, 2016 at 2:19 PM, Ilya Yaroshenko via
Digitalmars-d < digitalmars-d@puremagic.com> wrote:
On
maybe remove the corresponding DIP from
https://github.com/libmir/mir/wiki/Compiler-and-druntime-bugs#dips ?
On Thu, Sep 29, 2016 at 2:19 PM, Ilya Yaroshenko via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:
> On Thursday, 29 September 2016 at 21:06:13 UTC, Timothee Cour wrote:
>
>> this
On Thursday, 29 September 2016 at 20:57:00 UTC, ag0aep6g wrote:
On 09/29/2016 10:43 PM, Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 20:12:44 UTC, Walter Bright
wrote:
[...]
void foo(T)(T[] a ...)
{
printf("%d %d %d\n", a[0], a[1], a[2]);
}
[...]
a.length must be known at
On Thursday, 29 September 2016 at 21:06:13 UTC, Timothee Cour
wrote:
this works:
void foo(T, size_t n)(T[n] a ...) {...}
However, see this: https://github.com/libmir/mir/issues/337
On Thu, Sep 29, 2016 at 1:57 PM, Ilya Yaroshenko via
Digitalmars-d < digitalmars-d@puremagic.com> wrote:
On
this works:
void foo(T, size_t n)(T[n] a ...) {...}
However, see this: https://github.com/libmir/mir/issues/337
On Thu, Sep 29, 2016 at 1:57 PM, Ilya Yaroshenko via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:
> On Thursday, 29 September 2016 at 20:54:12 UTC, Ilya Yaroshenko wrote:
>
On Thursday, 29 September 2016 at 20:54:12 UTC, Ilya Yaroshenko
wrote:
On Thursday, 29 September 2016 at 20:47:35 UTC, Andrei
Alexandrescu wrote:
Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 18:55:07 UTC, Andrei
Alexandrescu wrote:
[...]
This is the
On 09/29/2016 10:43 PM, Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 20:12:44 UTC, Walter Bright wrote:
[...]
void foo(T)(T[] a ...)
{
printf("%d %d %d\n", a[0], a[1], a[2]);
}
[...]
a.length must be known at CT. 99%-100% foreach loops in ndslice package
are CT.
I'm not
On Thursday, 29 September 2016 at 20:47:35 UTC, Andrei
Alexandrescu wrote:
Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 18:55:07 UTC, Andrei
Alexandrescu wrote:
On 09/29/2016 02:53 PM, Ilya Yaroshenko wrote:
`(Index...)` -> `(size_t[] Index...)` // this
Ilya Yaroshenko wrote:
> On Thursday, 29 September 2016 at 18:55:07 UTC, Andrei
> Alexandrescu wrote:
>> On 09/29/2016 02:53 PM, Ilya Yaroshenko wrote:
>>> `(Index...)` -> `(size_t[] Index...)` // this is about template
>>> arguments, not runtime
>>
>> What is the
On Thursday, 29 September 2016 at 20:12:44 UTC, Walter Bright
wrote:
Here's one way to do it:
--
import core.stdc.stdio;
void foo(T)(T[] a ...)
{
printf("%d %d %d\n", a[0], a[1], a[2]);
}
void main()
{
foo(1, 2, 3);
}
-
C:\cbx>foo
1 2 3
a.length must be known at CT. 99%-100%
Here's one way to do it:
--
import core.stdc.stdio;
void foo(T)(T[] a ...)
{
printf("%d %d %d\n", a[0], a[1], a[2]);
}
void main()
{
foo(1, 2, 3);
}
-
C:\cbx>foo
1 2 3
On Thursday, 29 September 2016 at 18:56:40 UTC, Ilya Yaroshenko
wrote:
No, it does not
---
void foo(size_t[] I...)(I i)
{
}
Using phobos' allSatisfy or a similar template, this can become:
enum isIndex(T) = is(T == size_t);
void foo(I...)(I i) if(allSatisfy!(isIndex, I)){ ...
On Thursday, 29 September 2016 at 19:03:00 UTC, pineapple wrote:
On Thursday, 29 September 2016 at 18:56:40 UTC, Ilya Yaroshenko
wrote:
No, it does not
---
void foo(size_t[] I...)(I i)
{
}
Using phobos' allSatisfy or a similar template, this can become:
enum isIndex(T) = is(T ==
On Thursday, 29 September 2016 at 18:55:07 UTC, Andrei
Alexandrescu wrote:
On 09/29/2016 02:53 PM, Ilya Yaroshenko wrote:
`(Index...)` -> `(size_t[] Index...)` // this is about template
arguments, not runtime
What is the drawback of taking Index... and constraining it
with a template
On Thursday, 29 September 2016 at 18:53:26 UTC, Andrei
Alexandrescu wrote:
On 09/29/2016 02:37 PM, Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch
wrote:
Solution
T[] can be added to a template variadic name.
```
void foo(size_t[] Index...)(Indexes index)
{
On 9/29/16 2:49 PM, Stefan Koch wrote:
On Thursday, 29 September 2016 at 18:37:36 UTC, Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote:
Solution
T[] can be added to a template variadic name.
```
void foo(size_t[] Index...)(Indexes index)
{
...
}
On 09/29/2016 02:53 PM, Ilya Yaroshenko wrote:
`(Index...)` -> `(size_t[] Index...)` // this is about template
arguments, not runtime
What is the drawback of taking Index... and constraining it with a
template constraint (all must be integral)? We use that in a few places
in Phobos. --
On Thursday, 29 September 2016 at 18:49:45 UTC, Stefan Koch wrote:
On Thursday, 29 September 2016 at 18:37:36 UTC, Ilya Yaroshenko
wrote:
On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch
wrote:
Solution
T[] can be added to a template variadic name.
```
void foo(size_t[]
On 09/29/2016 02:37 PM, Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote:
Solution
T[] can be added to a template variadic name.
```
void foo(size_t[] Index...)(Indexes index)
{
...
}
```
This description does not tell me anything.
Current
On Thursday, 29 September 2016 at 18:37:36 UTC, Ilya Yaroshenko
wrote:
On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch
wrote:
Solution
T[] can be added to a template variadic name.
```
void foo(size_t[] Index...)(Indexes index)
{
...
}
```
This description does not tell me
On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote:
Solution
T[] can be added to a template variadic name.
```
void foo(size_t[] Index...)(Indexes index)
{
...
}
```
This description does not tell me anything.
Current template argument can be declared as `(Index...)`.
On Thursday, 29 September 2016 at 17:24:55 UTC, Ilya Yaroshenko
wrote:
Problem
Most ndslice API accepts variadic list of integers.
The following code example shows how `slice` and `[a, b, c]`
can generate 64 identical functions each.
```
// (1, 1U, 1UL, 1L) x
// (2, 2U, 2UL, 2L) x
// (3, 3U,
https://github.com/libmir/mir/wiki/Compiler-and-druntime-bugs#dips
Problem
Most ndslice API accepts variadic list of integers.
The following code example shows how `slice` and `[a, b, c]`
can generate 64 identical functions each.
```
// (1, 1U, 1UL, 1L) x
// (2, 2U, 2UL, 2L) x
// (3, 3U, 3UL, 3L) = 4 ^^ 3 = 64 identical variants
auto cube = slice!double(1, 2,
26 matches
Mail list logo