- Joined
- Oct 9, 2009
- Messages
- 9
- Reaction score
- 0
Hi all
do you know a nice way to find a range of elements in containers to retrieve a range of values as a std:air according to some custom predicate?
I would like to have something like the example below
typedef std::vector< int > v;
typedef std::vector< int >::iterator vit;
int values[] = { 1,2,3,4,5,6,7,8,9,10}
v vct( values, values+10);
std:air< vit,vit > res = get_range( vct.begin(), vct.end(), MYPREDICATE );
I saw std::equal_range but this looks for equality. Suppose I want to find
all values that are greater>2 and lower <6 and print all of those what can I do?
Thanks for your help.
CS
do you know a nice way to find a range of elements in containers to retrieve a range of values as a std:air according to some custom predicate?
I would like to have something like the example below
typedef std::vector< int > v;
typedef std::vector< int >::iterator vit;
int values[] = { 1,2,3,4,5,6,7,8,9,10}
v vct( values, values+10);
std:air< vit,vit > res = get_range( vct.begin(), vct.end(), MYPREDICATE );
I saw std::equal_range but this looks for equality. Suppose I want to find
all values that are greater>2 and lower <6 and print all of those what can I do?
Thanks for your help.
CS