Jack Applegame:
On Tuesday, 3 March 2015 at 17:49:24 UTC, bearophile wrote:
That's 1 + n-1 :-)
Could you please explain what does '1 + n-1' mean?
This is your code:
template Is(ARGS...) if(ARGS.length % 2 == 0) {
enum N = ARGS.length/2;
static if(N == 1) enum Is = is(ARGS[0] :
Seems like is expression doesn't support type tuples:
pragma(msg, is(short : int)); // true
enum Test(ARGS...) = is(ARGS[0..2] : ARGS[2..4]);
pragma(msg, is(Test!(int, int, int, int))); // false
pragma(msg, Test!(int, short, int, int)); // false
Is it by design, or just
Jack Applegame:
Seems like is expression doesn't support type tuples:
pragma(msg, is(short : int)); // true
enum Test(ARGS...) = is(ARGS[0..2] : ARGS[2..4]);
pragma(msg, is(Test!(int, int, int, int))); // false
pragma(msg, Test!(int, short, int, int)); // false
On Tuesday, 3 March 2015 at 16:42:22 UTC, bearophile wrote:
But it should be not too much hard to implement it your code.
Just use two is(), or use recursion (with splitting in two, and
not 1 + n-1).
Bye,
bearophile
I already have one:
template Is(ARGS...) if(ARGS.length % 2 == 0) {
Jack Applegame:
or use recursion (with splitting in two, and not 1 + n-1).
Bye,
bearophile
I already have one:
template Is(ARGS...) if(ARGS.length % 2 == 0) {
enum N = ARGS.length/2;
static if(N == 1) enum Is = is(ARGS[0] : ARGS[1]);
else enum Is = is(ARGS[0] : ARGS[N])
On Tuesday, 3 March 2015 at 17:49:24 UTC, bearophile wrote:
That's 1 + n-1 :-)
Could you please explain what does '1 + n-1' mean?
bearophile bearophileh...@lycos.com wrote:
Simen kjaeraas Wrote:
static assert( is( TypeTuple!( int, a ) == TypeTuple!( int, a ) );
Look for this problem in the digitalmars.D.learn group, because I have
seen this problem recently solved here (I don't remember the solution,
it was easy).
Simen kjaeraas simen.kja...@gmail.com wrote:
if ( SameTuple!( int, a ).As( int, a ) ) {}
Now if only someone would fix
http://d.puremagic.com/issues/show_bug.cgi?id=242
--
Simen
Simen kjaeraas:
I'd recommend something like this be added to Phobos.
Looks nice. There are many small bits of functionality like that that are
missing still in Phobos and can be added. I suggest you to put that code in a
bugzilla entry (otherwise I can do it myself) with a good unittest{} and
bearophile bearophileh...@lycos.com wrote:
Looks nice. There are many small bits of functionality like that that
are missing still in Phobos and can be added. I suggest you to put that
code in a bugzilla entry (otherwise I can do it myself) with a good
unittest{} and if you want a ddoc
10 matches
Mail list logo