A pattern I'd like to see more of - Parsing template parameter tuples
Neia Neutuladh
neia at ikeran.org
Mon May 21 00:58:10 UTC 2018
On Monday, 21 May 2018 at 00:13:26 UTC, Ethan wrote:
> Code for context:
> https://github.com/GooberMan/binderoo/blob/master/binderoo_client/d/src/binderoo/util/enumoptions.d
This looks good. One small caveat:
alias DocumentType = SomeDocument!(ObjectVersion._1_0,
ObjectEncoding.UTF8);
alias DocumentType2 = SomeDocument!(ObjectEncoding.UTF8,
ObjectVersion._1_0);
These are not the same type; they're two identical types with
different mangles. You can fix that with a layer of indirection:
template SomeDocument(Options...)
{
alias SomeDocument =
SomeDocumentImpl!(OptionsOf!(DocumentParams, Options));
}
More information about the Digitalmars-d
mailing list