Map one tuple to another Tuple of different type

Daniel Gibson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 21 11:50:45 PDT 2014


Am 21.07.2014 20:09, schrieb H. S. Teoh via Digitalmars-d-learn:
> On Mon, Jul 21, 2014 at 06:36:04PM +0200, Daniel Gibson via Digitalmars-d-learn wrote:
> [...]
>> However, having something like staticIota in the stdlib would probably
>> make sense.
> [...]
>
> It's already in std.typecons.
>
> (Admittedly, that's not exactly the most obvious place to look for it...)
>
>
> T
>

static.typecons is actually where I would have expected it, as it 
constructs a tuple.. but it isn't mentioned on 
http://dlang.org/library/std/typecons.html or 
http://dlang.org/phobos/std_typecons.html
and at least in my /usr/include/dmd/phobos/std/typecons.d (2.065) it's 
private:
private template staticIota(int beg, int end)
{ ... }
And it seems like I can't use it.
Anyway, good to know that it exists and hopefully future versions of D2 
make that function public, so thanks for showing up another alternative 
to solve my problem :-)

BTW: The name "Iota" is horrible.. it doesn't describe at all what the 
function does.
And "But C++11 STL has a function of the same name that does the same 
thing" or "some obscure programming language from the 60ies (APL) used 
the Greek iota letter to do this" is no excuse, one shouldn't expect 
potential D users to know about that (even after using C++ for years I 
never encountered std::iota..)
Maybe "Numerate" or something like that would be more descriptive..

Cheers,
Daniel


More information about the Digitalmars-d-learn mailing list