Boost logo

Boost Users :

From: David Brownell (david_brownell_at_[hidden])
Date: 2004-01-25 00:43:23


My apologies everyone, I guess I wasn't very clear of what I was hoping that
the function Foo would return.

If I have the interval {2, 6, 10, 14, 18 }, I would like Foo(N) to return
the value in the interval that is >= N, but less than the max value in the
interval. I am looking over my examples, and I think a typo of mine clouded
the issue as well..

i.Foo(2) == 2
i.Foo(6) == 6 <-- Should have been 6, I erroneously typed 2 on my previous
message
i.Foo(0) == 2
i.Foo(18) == 18
i.Foo(20) == 18
i.Foo(5) == 6
i.Foo(3) == 6

Thanks,
David Brownell

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Daryle Walker
Sent: Saturday, January 24, 2004 4:20 PM
To: Boost Users mailing list
Subject: Re: [Boost-users] Interval Library?

On 1/21/04 5:22 PM, "David Brownell" <david_brownell_at_[hidden]> wrote:

[SNIP]
> I would like an Interval that goes from a min_value to a max_value,
> where each value is the previous value + N.

I think std::valarray<> has something like this.

> 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 think the val-array slice goes "start, length, stride", so the values for
the slice object would be (2, 5, 4).

> 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
[TRUNCATE]

What problem are you trying to solve? Also, I can't see any pattern for the
"Foo" function.

--
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net