April 16, 2015
On Thursday, 16 April 2015 at 10:24:05 UTC, Per Nordlöw wrote:
> How is this possible? Shouldn't it CT-evaluate to
>
>     struct Index { ... }
>
> !?

Ahh, in the case when I is "I". Ok I get it. That's the reason.

Thx
April 16, 2015
On Wednesday, 15 April 2015 at 16:21:59 UTC, Nordlöw wrote:
> Help please.

I'm quite satisfied with the current state now.

Is anybody interested in having this in typecons.d in Phobos?
April 16, 2015
On Thursday, 16 April 2015 at 10:27:20 UTC, Per Nordlöw wrote:
> On Wednesday, 15 April 2015 at 16:21:59 UTC, Nordlöw wrote:
>> Help please.
>
> I'm quite satisfied with the current state now.
>
> Is anybody interested in having this in typecons.d in Phobos?

I would be, yes.

Have you considered what happens if you apply it to a type that uses the new opIndex/opSlice semantics?
April 16, 2015
On Thursday, 16 April 2015 at 10:46:25 UTC, John Colvin wrote:
> On Thursday, 16 April 2015 at 10:27:20 UTC, Per Nordlöw wrote:
>> On Wednesday, 15 April 2015 at 16:21:59 UTC, Nordlöw wrote:
>>> Help please.
>>
>> I'm quite satisfied with the current state now.
>>
>> Is anybody interested in having this in typecons.d in Phobos?
>
> I would be, yes.
>
> Have you considered what happens if you apply it to a type that uses the new opIndex/opSlice semantics?

I guess you mean Kenjis multidim array indexing and slicing.

If so, I haven't thought of that. I'm very open to suggestions.

Is there a way to CT-query the arity of all opIndex and opSlice overloads?
April 20, 2015
On Thursday, 16 April 2015 at 18:12:35 UTC, Nordlöw wrote:
> Is there a way to CT-query the arity of all opIndex and opSlice overloads?

Ping.
April 20, 2015
On Mon, 20 Apr 2015 13:31:03 +0000, Nordlöw wrote:

> On Thursday, 16 April 2015 at 18:12:35 UTC, Nordlöw wrote:
>> Is there a way to CT-query the arity of all opIndex and opSlice overloads?
> 
> Ping.

as long as they aren't templates, you can use any function traits on 'em. like `ParameterTypeTuple!(A.opIndex).length` for example.

with templated opXXX i believe that there is no simply way to get argument tuple.

April 20, 2015
On Thursday, 16 April 2015 at 18:12:35 UTC, Nordlöw wrote:
> Is there a way to CT-query the arity of all opIndex and opSlice overloads?

Ideally you don't want to have to do that. You'd have to consider alias this and inheritance.
April 21, 2015
On Monday, 20 April 2015 at 13:49:41 UTC, John Colvin wrote:
> On Thursday, 16 April 2015 at 18:12:35 UTC, Nordlöw wrote:
>> Is there a way to CT-query the arity of all opIndex and opSlice overloads?
>
> Ideally you don't want to have to do that. You'd have to consider alias this and inheritance.

How do you plan on overriding the behaviour of opIndex and opSlice with alias this and inheritance?

We don't want to limit this classes only.

Fixed-dimensional matrices (in 2D/3D graphics) is a typically example of where we want to use structs instead.

Typical use case is a Matrix class having index dimension RowIndex and ColumnIndex.
April 21, 2015
On Tuesday, 21 April 2015 at 06:56:33 UTC, Per Nordlöw wrote:
> On Monday, 20 April 2015 at 13:49:41 UTC, John Colvin wrote:
>> On Thursday, 16 April 2015 at 18:12:35 UTC, Nordlöw wrote:
>>> Is there a way to CT-query the arity of all opIndex and opSlice overloads?

Further, this is slightly related to a way to query the dimensions of a data-type. If possible I would like to have a type trait for this. This type-trait could then be used both for this challenge but also for figuring out how to create randomized instances of multi-dimensional structures. This can be used for automatic generation of data instances of parameters in algorithm testing and benchmarking.
April 21, 2015
On Tuesday, 21 April 2015 at 07:01:27 UTC, Per Nordlöw wrote:
> On Tuesday, 21 April 2015 at 06:56:33 UTC, Per Nordlöw wrote:
>> On Monday, 20 April 2015 at 13:49:41 UTC, John Colvin wrote:
>>> On Thursday, 16 April 2015 at 18:12:35 UTC, Nordlöw wrote:
>>>> Is there a way to CT-query the arity of all opIndex and opSlice overloads?
>
> Further, this is slightly related to a way to query the dimensions of a data-type. If possible I would like to have a type trait for this. This type-trait could then be used both for this challenge but also for figuring out how to create randomized instances of multi-dimensional structures. This can be used for automatic generation of data instances of parameters in algorithm testing and benchmarking.

template dimensionality (S) {
  template count_dim (uint i = 0) {
    static if (is (typeof(S.init.opSlice!i (0,0))))
      enum count_dim = count_dim!(i+1);
    else enum count_dim = i;
  }

  alias dimensionality = count_dim!();
}

Then you throw in some more stuff to detect 1-dimensional cases.