H
howard
If you have a sorted collection, how do you find the location ^closest^
to where a particular key would be if an element with key isn't in the
collection?
For example, if you have a SortedArray containing:
{ 1.102, "fox" }
{ 1.592, "cat" }
{ 2.239, "dog" }
how do you get an interator that points to the location where { 1.910,
"otter" } would be inserted? (I guess in this case the functional
equivalent of an iterator is the index of.)
What I'm hoping for is something that looks like:
int index = mySortedArray.find(1.910); // sets index = 2
Thanks,
H
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
to where a particular key would be if an element with key isn't in the
collection?
For example, if you have a SortedArray containing:
{ 1.102, "fox" }
{ 1.592, "cat" }
{ 2.239, "dog" }
how do you get an interator that points to the location where { 1.910,
"otter" } would be inserted? (I guess in this case the functional
equivalent of an iterator is the index of.)
What I'm hoping for is something that looks like:
int index = mySortedArray.find(1.910); // sets index = 2
Thanks,
H
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!