Re: Tuple to tuple conversion

2010-06-07 Thread Lars T. Kyllingstad
On Tue, 08 Jun 2010 03:29:05 +0200, Simen kjaeraas wrote: > Sounds stupid, don't it? > 123456789012345678901234567890123456789012345678901234567890123456789012 > Carrying in my hat my trusty foo, a std.typecons.Tuple!(float), I want > to use it as a parameter to a function taking non-tuple paramet

Re: why is this cast necessary?

2010-06-07 Thread Ellery Newcomer
On 06/07/2010 10:02 PM, Graham Fawcett wrote: Hi folks, This program works as expected in D2: import std.stdio; import std.algorithm; T largestSubelement(T)(T[][] lol) { alias reduce!"a>b?a:b" max; return cast(T) max(map!max(lol)); // the cast matters... }

Re: why is this cast necessary?

2010-06-07 Thread Steven Schveighoffer
On Mon, 07 Jun 2010 23:02:48 -0400, Graham Fawcett wrote: Hi folks, This program works as expected in D2: import std.stdio; import std.algorithm; T largestSubelement(T)(T[][] lol) { alias reduce!"a>b?a:b" max; return cast(T) max(map!max(lol)); // the cast matters.

why is this cast necessary?

2010-06-07 Thread Graham Fawcett
Hi folks, This program works as expected in D2: import std.stdio; import std.algorithm; T largestSubelement(T)(T[][] lol) { alias reduce!"a>b?a:b" max; return cast(T) max(map!max(lol)); // the cast matters... } void main() { auto a = [[1,2,3],[4,5,6],[8,9

Re: Tuple to tuple conversion

2010-06-07 Thread Simen kjaeraas
Simen kjaeraas wrote: I guess what I'm asking for here is, is there a way to do what I want? Hm, it seems the problem was not where I thought it was. However, this is getting curiouser and curiouser. -- Simen

Tuple to tuple conversion

2010-06-07 Thread Simen kjaeraas
Sounds stupid, don't it? 123456789012345678901234567890123456789012345678901234567890123456789012 Carrying in my hat my trusty foo, a std.typecons.Tuple!(float), I want to use it as a parameter to a function taking non-tuple parameters, i.e. a single float. foo.tupleof gives me an unwieldy conglom

Re: Handy templates

2010-06-07 Thread Simen kjaeraas
Simen kjaeraas wrote: Another few that showed up now with my work on combinatorial products of ranges: /** Determines whether a template parameter is a type of value (alias). Example: template foo( T... ) if (allSatisfy!( isAlias, T ) {...} */ template isAlias( alias T ) { en

Re: delegates with C linkage

2010-06-07 Thread Don
Simen kjaeraas wrote: dennis luehring wrote: D still won't accept an delegat in an extern C because this type does not exists in the C world Nor do classes, and those certainly can be passed to a C-linkage function. Yes, but I think that's a bug too. Quite a horrible one, in fact, since t