On Tuesday, 21 April 2015 at 20:30:00 UTC, Vlad Levenfeld wrote:
Should work for any case I can think of (assuming integral
indices).
Thanks.
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 static if (i == 0 && (isInputRange!S || is
(typeof(S.init[0])))
enum count_dim = 1;
else enum count_dim = i;
}
ali
On Tuesday, 21 April 2015 at 19:46:03 UTC, Nordlöw wrote:
On Tuesday, 21 April 2015 at 07:46:03 UTC, Vlad Levenfeld wrote:
Then you throw in some more stuff to detect 1-dimensional
cases.
Could you please elaborate a bit?
Well assuming the type is not multidimensional (does not define
opSli
On Tuesday, 21 April 2015 at 07:46:03 UTC, Vlad Levenfeld wrote:
Then you throw in some more stuff to detect 1-dimensional cases.
Could you please elaborate a bit?
As an aside, I've put a bit of work into the generic
multidimensional containers problem lately and have an interface
generating library as a result.
https://github.com/evenex/autodata
It's still in the nascent stages but contains a lot of tools for
working with multidimensional structures.
On Tuesday, 21 April 2015 at 08:09:38 UTC, Per Nordlöw wrote:
On Tuesday, 21 April 2015 at 07:46:03 UTC, Vlad Levenfeld wrote:
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 c
On Tuesday, 21 April 2015 at 07:46:03 UTC, Vlad Levenfeld wrote:
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!();
}
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
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
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.
Ho
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.
On Mon, 20 Apr 2015 13:31:03 +, 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 `ParameterT
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.
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 typec
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 ha
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
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?
On Wednesday, 15 April 2015 at 23:02:32 UTC, Ali Çehreli wrote:
struct I {
alias T = size_t;
this(T ix) { this._ix = ix; }
T opCast(U : T)() const { return _ix; }
private T _ix = 0;
}
How is this possible? Sh
On 04/15/2015 03:42 PM, "Nordlöw" wrote:
> On Wednesday, 15 April 2015 at 20:12:27 UTC, Ali Çehreli wrote:
>> Ali
>
> I cracked it:
>
> Reason: I hade a failing unittest using it as
>
> auto xs = x.indexedBy!"I";
>
> which I changed to
>
> auto xs = x.indexedBy!"Ix";
>
> For some reason
On 4/15/15 6:42 PM, "Nordlöw" wrote:
On Wednesday, 15 April 2015 at 20:12:27 UTC, Ali Çehreli wrote:
Ali
I cracked it:
Reason: I hade a failing unittest using it as
auto xs = x.indexedBy!"I";
which I changed to
auto xs = x.indexedBy!"Ix";
For some reason the mixin magic becomes
On Wednesday, 15 April 2015 at 20:12:27 UTC, Ali Çehreli wrote:
Ali
I cracked it:
Reason: I hade a failing unittest using it as
auto xs = x.indexedBy!"I";
which I changed to
auto xs = x.indexedBy!"Ix";
For some reason the mixin magic becomes confused when I equals
"I".
Do you ha
On 04/15/2015 12:19 PM, "Nordlöw" wrote:
I'm using DMD 2.067.
Mee too. The following is the minimum amount of code I used, which compiles:
import std.traits;
import std.range;
struct Index(T = size_t) if (isUnsigned!T)
{
this(T ix) { this._ix = ix; }
T opCast(U : T)() const { return _
I'm using DMD 2.067.
On Wednesday, 15 April 2015 at 19:15:36 UTC, Nordlöw wrote:
errors
typecons_ex.d(135,5): Error: mixin
typecons_ex.IndexedBy!(int[3], "I").IndexedBy.genOps!"I" does
not match template declaration genOps(T)
typecons_ex.d(152,12): Error: template instance
typecons_ex.IndexedBy!(int[3], "I") erro
On Wednesday, 15 April 2015 at 17:03:36 UTC, Ali Çehreli wrote:
This seems to work:
mixin genOps!(mixin(I));
I'm afraid not:
mixin genOps!(mixin(I));
errors
typecons_ex.d(135,5): Error: mixin typecons_ex.IndexedBy!(int[3],
"I").IndexedBy.genOps!"I" does not match template declarati
On 04/15/2015 09:21 AM, "Nordlöw" wrote:
At
https://github.com/nordlow/justd/blob/master/typecons_ex.d#L143
I can't figure out how to make the call to
mixin genOps!I;
expand to, for instance,
mixin genOps!Index
This seems to work:
mixin genOps!(mixin(I));
in the case when
26 matches
Mail list logo