RFC: Units of measurement for D (Phobos?)

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 16 15:34:04 PDT 2016


On Wednesday, 16 March 2016 at 22:16:20 UTC, Nordlöw wrote:
> How should then sin, cos, tan, expi be redesigned to support 
> `ScaledUnit` aswell as `Quantity`?

What you can do is to take an arbitrary quantity with an 
(angle.canConvert!radian) template constraint. Inside the 
function, you then simply use cos(angle.convert!radian / radian) 
or whatever.

  — David


More information about the Digitalmars-d mailing list