bearophile <bearophileh...@lycos.com> wrote:

Simen kjaeraas:

Bounded!(int, 1, 5)[] myArr;
myArr ~= 1; // Compile-time error: int is not implicitly castable to
Bounded!(int, 1, 5)
myArr ~= Bounded!(int, 1, 5)( 1 ); // Works perfectly

I can't say this is a nice syntax :-)
(Isn't the implicit conversion + bound test better?)

Not sure. This way is more explicit, and errors will be caught at
compile-time.

--
Simen

Reply via email to