get from tuple by type

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 15 16:28:18 PDT 2015


On Sun, 15 Mar 2015 23:17:34 +0000, Charles Cooper wrote:

> Sure. It is also easy to write merge sort. Or std.typetuple.Erase. Or
> Tuple.opIndex(size_t). But that doesn't mean everybody does it. Some
> utilities (and I am not saying this is, but it could be) are widely used
> enough that it makes sense to put them in the standard.

sorry if you feel offended, i never meant that. what i meant is that it's 
hard in c++, but easy in D when one knows how to do that. i've learned D 
mostly by reading other people code, and there is nothing wrong in asking 
questions, quite the contrary.

but the requested solution is not "universal" enough to be included in 
Phobos (what if i want an index instead of a value? or (index, value) 
tuple? or just check if it is there? or find either `int` or `double`?). 
it's easier to write specialized template for required cases than to try 
to make it generic (and complex) enough. but it's much harder to write 
that in c++, to the extent that it's easier to include that things in 
standard.

just stay with us and you will see that D shines in such things (and in 
many other areas too ;-).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150315/1ea5e5b1/attachment.sig>


More information about the Digitalmars-d-learn mailing list