Click here to Skip to main content
15,914,071 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Is there a fast method for doing this? Pin
David Crow2-May-03 8:24
David Crow2-May-03 8:24 
GeneralA question about IE Pin
Carlos Antollini30-Apr-03 2:52
Carlos Antollini30-Apr-03 2:52 
GeneralRe: A question about IE Pin
Anonymous30-Apr-03 3:10
Anonymous30-Apr-03 3:10 
GeneralRe: A question about IE Pin
Stephane Rodriguez.30-Apr-03 3:17
Stephane Rodriguez.30-Apr-03 3:17 
GeneralProblem with CRecordSet Pin
Poul Haahr Klemmensen30-Apr-03 1:46
Poul Haahr Klemmensen30-Apr-03 1:46 
GeneralRe: Problem with CRecordSet Pin
David Crow30-Apr-03 2:50
David Crow30-Apr-03 2:50 
GeneralRe: Problem with CRecordSet Pin
Poul Haahr Klemmensen30-Apr-03 2:59
Poul Haahr Klemmensen30-Apr-03 2:59 
GeneralSTL algorithm Pin
Rage30-Apr-03 1:36
professionalRage30-Apr-03 1:36 
Hi!

I have a vector<int> which could be {0 2 53 84 962 1120}, i.e. it is sorted.
Now assume I have a value x, i'd like to get the highest value which is lower than x in the list. (i.e. if x =250, the result would be 84, since 84<250 and 250>962)

Of course, I already have a solution -- iterating through the vector, but i'd like to know if there is a way to do it using algorithm (like defining a predicate less<int,250> and using the max_element algorithm with that predicate (which would throw the max value of the vector which is lower than 250 Unsure | :~ Ouf !). Is that possible ? If yes, what would be the exact code for it ?

Thanks !

~RaGE();
GeneralRe: STL algorithm Pin
markkuk30-Apr-03 2:10
markkuk30-Apr-03 2:10 
GeneralRe: STL algorithm Pin
Rage30-Apr-03 5:42
professionalRage30-Apr-03 5:42 
GeneralRe: STL algorithm Pin
User 988530-Apr-03 2:18
User 988530-Apr-03 2:18 
GeneralRe: STL algorithm Pin
Rage30-Apr-03 5:42
professionalRage30-Apr-03 5:42 
GeneralRe: STL algorithm Pin
Giles30-Apr-03 2:35
Giles30-Apr-03 2:35 
GeneralRe: STL algorithm Pin
Rage30-Apr-03 5:41
professionalRage30-Apr-03 5:41 
GeneralRe: STL algorithm Pin
Andrew Walker30-Apr-03 2:55
Andrew Walker30-Apr-03 2:55 
GeneralRe: STL algorithm Pin
Rage30-Apr-03 5:40
professionalRage30-Apr-03 5:40 
QuestionCan I use 1 template function instead of 2? Pin
grscot30-Apr-03 1:28
grscot30-Apr-03 1:28 
AnswerRe: Can I use 1 template function instead of 2? Pin
Pankaj Singh30-Apr-03 3:42
Pankaj Singh30-Apr-03 3:42 
GeneralEditor Pin
y_seval30-Apr-03 1:06
y_seval30-Apr-03 1:06 
GeneralRe: Editor Pin
Neville Franks30-Apr-03 1:40
Neville Franks30-Apr-03 1:40 
GeneralDateTimePicker problem! Pin
_skidrow_vn_30-Apr-03 1:03
_skidrow_vn_30-Apr-03 1:03 
GeneralRe: DateTimePicker problem! Pin
David Crow30-Apr-03 3:01
David Crow30-Apr-03 3:01 
GeneralRe: DateTimePicker problem! Pin
_skidrow_vn_30-Apr-03 7:49
_skidrow_vn_30-Apr-03 7:49 
GeneralTwo Rich Edit Questions Pin
Gio S.29-Apr-03 23:03
Gio S.29-Apr-03 23:03 
GeneralRe: Two Rich Edit Questions Pin
John R. Shaw30-Apr-03 9:27
John R. Shaw30-Apr-03 9:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.