Preliminary submission - std.rational and std.typelist

David Nadlinger see at klickverbot.at
Sat Oct 6 11:08:48 PDT 2012


On Saturday, 6 October 2012 at 18:13:19 UTC, Arlen wrote:
> For example, if you have two TypeTuples, A and B, what would 
> the signature of the metafunction to merge the two look like?

In my experience, these cases occur a lot less frequently than 
one might think when first encountering the problem. The solution 
I usually go for is to just define a ConfinedTuple (or something 
like that) template:

---
template ConfinedTuple(T...) {
   alias T Tuple;
}

template SomeAlgorithm(alias A, alias B) {}
---

Then, call that one algorithm using 
SomeAlgorithm!(ConfinedTuple!A, ConfinedTuple!B). At least to me, 
it seems to be the better tradeoff compared to re-implementing 
all the TypeTuple functionality for another compile-time tuple 
type.

David


More information about the Digitalmars-d mailing list