Boost logo

Boost :

From: Robert Kawulak (kawulak_at_[hidden])
Date: 2005-09-23 06:47:17

> I have written something like this for signal processing
> application. The
> bounded types are integer-like. Basically, all it does it
> perform a check
> action when a value is assigned to it. The check function is
> specified as
> a template policy parameter. The version I wrote has three
> policies. If
> the assigned value is out of range, the action could
> 1) limit to the desired range
> 2) wrap the value (as if an integer of some small width)
> 3) throw

Yeah, there are all the abovementioned behaviours implemented in my version,
plus ignore (for efficiency in release versions). Furthermore, in case 3 you
may choose among throwing an exception, setting the ERRNO or simply ignoring
the invalid operation. Of course the policies are extensible and let you
specify other action than listed above. And the policies let you also pick
your own ordering function used to compare values against bounds (this is
especially useful when using them with non-integral types).

Anyway, having experience in writing such class, could you tell if something
needs changing in my implementation, or possibly if you think your
implementation might be better place it somewhere to download?

Best regards,

Boost list run by bdawes at, gregod at, cpdaniel at, john at