
23 Dec
2008
23 Dec
'08
2:20 p.m.
Gordon Woodhull wrote:
On Dec 22, 2008, at 1:47 PM, Neal Becker wrote:
I'm interested in something like constrained, but applied to a vector of values. The case I'm interested in is a homogeneous vector of bounded int values, with bounds set at runtime.
It is trivial to have a vector<bounded<int> >, but this would not be space efficient in the case where the policies, bounds on all the values are the same.
Not as general, but possible right now: use bounded with the bounds as static members. This gives you as many classes of constraints as you care to spell out. Example follows.
Interesting example. IIUC, though, what I need is run-time bounds and the example is compile-time.