Tuple to tuple conversion

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Mon Jun 7 23:53:20 PDT 2010


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 parameters, i.e.
> a single float. foo.tupleof gives me an unwieldy conglomerate of
> tuple((Tuple!(float))._field_field_0,(Tuple!(float))._0). First, I'm not
> sure what all of this means, second I'm completely sure it does not mean
> what I want.
> 
> foo.field seems much more close to what I want, returning a nice and
> clean (float) when I ask for it. However, doing so in the context of
> being a function parameter yields other problems, in the form of:
> 
> src\phobos\std\typecons.d(424): Error: static assert
> (is(Tuple!(string,float) == Tuple!(string,float))) is false
> src\phobos\std\typecons.d(413):        instantiated from here:
> Tuple!(string,float)
> src\phobos\std\typecons.d(423):        instantiated from here:
> slice!(1,3) problem.d(15):        3 recursive instantiations from here:
> Tuple!(float)

FWIW, I've run across the same error, while writing code that had nothing 
to do with tuples.  And I've seen others complaining about it too.  It 
seems to be a rather elusive bug in Phobos.

-Lars


More information about the Digitalmars-d-learn mailing list