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

C / C++ / MFC

 
GeneralMultiple modal dialog boxes Pin
Deepak Samuel21-Jul-03 7:11
Deepak Samuel21-Jul-03 7:11 
Generala casting problem! Pin
safee ullah21-Jul-03 7:11
safee ullah21-Jul-03 7:11 
GeneralRe: a casting problem! Pin
Dominik Reichl21-Jul-03 7:19
Dominik Reichl21-Jul-03 7:19 
GeneralRe: a casting problem! Pin
Joaquín M López Muñoz21-Jul-03 7:28
Joaquín M López Muñoz21-Jul-03 7:28 
GeneralRe: a casting problem! Pin
safee ullah21-Jul-03 22:48
safee ullah21-Jul-03 22:48 
GeneralRe: a casting problem! Pin
Jens Doose21-Jul-03 22:25
Jens Doose21-Jul-03 22:25 
Generalstd::sort() passes invalid parameter to sorting callback function Pin
s_k21-Jul-03 7:02
s_k21-Jul-03 7:02 
GeneralRe: std::sort() passes invalid parameter to sorting callback function Pin
Joaquín M López Muñoz21-Jul-03 7:18
Joaquín M López Muñoz21-Jul-03 7:18 
At first sight, there're two problems with your code. The first one is not critical, but anyway: The comparison
if (m_vecItems.size() > m_vecItems.capacity())
is always false, so there's no point in checking it. By definition, the size of a vector canot be larger than its capacity. As for
if (m_vecItems.size() == m_vecItems.capacity())
it is not really necessary (vectors grow as necessary automatically), but it can improve performance, so no problem about it.
The real problem (I guess) is that sort expects a comparison predicate that has less-than semantics, i.e. it expects it to return true is the first argument if less than the second, and false otherwise. Your sortCallback has (<0,0,>0) semantics: change it to what I've indicated and things will probably start to work OK. Good luck.


Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: std::sort() passes invalid parameter to sorting callback function Pin
s_k22-Jul-03 2:30
s_k22-Jul-03 2:30 
QuestionDetect USB Port Version? Pin
nng3821-Jul-03 5:57
nng3821-Jul-03 5:57 
AnswerRe: Detect USB Port Version? Pin
John M. Drescher21-Jul-03 6:14
John M. Drescher21-Jul-03 6:14 
GeneralRe: Top Window Pin
Niall Barr21-Jul-03 6:20
professionalNiall Barr21-Jul-03 6:20 
Generalwriting to the registry Pin
si_6921-Jul-03 5:28
si_6921-Jul-03 5:28 
GeneralRe: writing to the registry Pin
John M. Drescher21-Jul-03 7:11
John M. Drescher21-Jul-03 7:11 
GeneralRe: writing to the registry Pin
Dominik Reichl21-Jul-03 7:12
Dominik Reichl21-Jul-03 7:12 
GeneralRe: writing to the registry Pin
Jens Doose21-Jul-03 22:30
Jens Doose21-Jul-03 22:30 
Generalprocessing video from a TV Tuner card Pin
Cyberizen21-Jul-03 5:18
Cyberizen21-Jul-03 5:18 
GeneralRe: processing video from a TV Tuner card Pin
Ryan Binns21-Jul-03 5:26
Ryan Binns21-Jul-03 5:26 
GeneralRe: processing video from a TV Tuner card Pin
John M. Drescher21-Jul-03 17:50
John M. Drescher21-Jul-03 17:50 
GeneralAdding name to propertysheet dialog Pin
keegan21-Jul-03 5:08
keegan21-Jul-03 5:08 
GeneralRe: Adding name to propertysheet dialog Pin
G. Steudtel21-Jul-03 5:21
G. Steudtel21-Jul-03 5:21 
GeneralRe: Adding name to propertysheet dialog Pin
Ryan Binns21-Jul-03 5:25
Ryan Binns21-Jul-03 5:25 
GeneralRe: Adding name to propertysheet dialog Pin
Ryan Binns21-Jul-03 5:24
Ryan Binns21-Jul-03 5:24 
GeneralRe: Adding name to propertysheet dialog Pin
keegan21-Jul-03 6:27
keegan21-Jul-03 6:27 
GeneralRequesting column information for stored procedures through ADO connection Pin
Daed21-Jul-03 4:48
Daed21-Jul-03 4:48 

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.