Using this:

struct Grams
{
    size_t amount;
}

@property Grams grams(size_t amount)
{
    return Grams(amount);
}

void main()
{
    auto weight = 5.grams;
    weight = weight + 10.grams;
}

How would you use it? I thought the point of this sort of strong typing was to be able to carry out arithmetic using your type that other units cannot accidentally be mixed with.

Reply via email to