On Tuesday, 5 June 2012 at 22:17:57 UTC, bearophile wrote:

Or you can add an assert/enforce, or you can create a small struct that represent safely assignable uints, etc. No solution is good.

Bye,
bearophile

Surely structs could work?

struct safeType(T) {
  T value;
}

Define all operations that you can safely perform on T on the struct, but only with structs of the same type and on T. It wouldn't be very pretty, but I would work, wouldn't it? Writing the template would be annoying but you'd only have to do it once.

Reply via email to