get from tuple by type
Charles Cooper via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Mar 15 16:28:15 PDT 2015
True. If I had to do something involving such an API I would
first wrap the API with a type safe one before doing anything
else.
void external_api_do_something(uint dollars, uint cents);
/* I think this could somehow be automated with staticMap and
ParameterTypeTuple / ParameterIdentifierTuple */
alias dollars_t = Typedef!(uint, uint.init, "dollars");
alias cents_t = Typedef!(uint, uint.init, "cents");
void internal_api_do_something(dollars_t, cents_t);
On Sunday, 15 March 2015 at 23:20:22 UTC, anonymous wrote:
> On Sunday, 15 March 2015 at 23:13:58 UTC, Charles Cooper wrote:
>
> How would GetByType help here? Both members are uint, so you
> can't distinguish them by type. And if you gave them distinct
> types, the bad example here wouldn't compile anymore either.
More information about the Digitalmars-d-learn
mailing list