21 Jan
2004
21 Jan
'04
10:22 p.m.
I think I am looking for functionality that is contained with the Interval library, but am having a hard time digesting the documentation for this particular library. I would like an Interval that goes from a min_value to a max_value, where each value is the previous value + N. For example, the interval {2, 6, 10, 14, 18} has a minimum value of 2, a maximum value of 18, and increments by 4. Given this interval, I would like a function, Foo, that works as follows: Interval(2, 18, 4) i; i.Foo(2) == 2 i.Foo(6) == 2 i.Foo(0) == 2 i.Foo(18) == 18 i.Foo(20) == 18 i.Foo(5) == 6 i.Foo(3) == 6 Is this something that can be done with the Interval library, or am I missing the point? :) Thanks in advance for your help! David Brownell