Click here to Skip to main content
15,846,006 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Always on top (modeless) dialog box Pin
Hadi Dayvary8-Nov-11 8:03
professionalHadi Dayvary8-Nov-11 8:03 
GeneralRe: Always on top (modeless) dialog box Pin
David Crow8-Nov-11 9:43
David Crow8-Nov-11 9:43 
GeneralRe: Always on top (modeless) dialog box Pin
Hadi Dayvary8-Nov-11 20:40
professionalHadi Dayvary8-Nov-11 20:40 
AnswerRe: Always on top (modeless) dialog box Pin
basementman8-Nov-11 5:37
basementman8-Nov-11 5:37 
GeneralRe: Always on top (modeless) dialog box Pin
Hadi Dayvary8-Nov-11 8:06
professionalHadi Dayvary8-Nov-11 8:06 
QuestionCalling DLL methods related problem Pin
Member 83440907-Nov-11 20:31
Member 83440907-Nov-11 20:31 
AnswerRe: Calling DLL methods related problem Pin
Richard MacCutchan7-Nov-11 23:38
mveRichard MacCutchan7-Nov-11 23:38 
Questionreturning std::pair<> Pin
User 5838527-Nov-11 18:47
User 5838527-Nov-11 18:47 
I first saw this technique in the stl where collections return
std::pair<iterator, bool>
from their insert method. The bool indicating if the item was inserted or already existed.

Personally I dislike this, I find the names first and second which identify the pair's elements very misleading and find I'm constantly having to look at doco to see what something is. The worst case I've seen was along the lines of
pair<bool, pair<bool, bool>
. How could anyone be expected to remember what result.second.first is?

I prefer to pass in a reference to a variable

eg

iterator map::insert(iterator position, const value_type& x, bool& wasAdded)

This has the disadvantage that the caller has to allocate a bool and pass it in even if they're not interested in the result (this can be overcome by using a pointer with default value of NULL but that's also ugly)

I blame python and its tuples for this outrage. What do others think?
AnswerRe: returning std::pair Pin
Chuck O'Toole7-Nov-11 19:49
Chuck O'Toole7-Nov-11 19:49 
GeneralRe: returning std::pair Pin
Erudite_Eric7-Nov-11 22:30
Erudite_Eric7-Nov-11 22:30 
GeneralRe: returning std::pair Pin
User 5838527-Nov-11 23:05
User 5838527-Nov-11 23:05 
GeneralRe: returning std::pair Pin
Malli_S8-Nov-11 2:39
Malli_S8-Nov-11 2:39 
GeneralRe: returning std::pair Pin
Albert Holguin9-Nov-11 10:30
professionalAlbert Holguin9-Nov-11 10:30 
AnswerRe: returning std::pair Pin
jschell8-Nov-11 10:58
jschell8-Nov-11 10:58 
Questionif(NULL == MyPointer) Pin
User 5838527-Nov-11 16:37
User 5838527-Nov-11 16:37 
AnswerRe: if(NULL == MyPointer) Pin
Dr.Walt Fair, PE7-Nov-11 16:45
professionalDr.Walt Fair, PE7-Nov-11 16:45 
AnswerRe: if(NULL == MyPointer) Pin
Chuck O'Toole7-Nov-11 18:43
Chuck O'Toole7-Nov-11 18:43 
AnswerRe: if(NULL == MyPointer) Pin
«_Superman_»7-Nov-11 19:08
professional«_Superman_»7-Nov-11 19:08 
GeneralRe: if(NULL == MyPointer) Pin
Stefan_Lang10-Nov-11 4:46
Stefan_Lang10-Nov-11 4:46 
AnswerRe: if(NULL == MyPointer) Pin
Malli_S8-Nov-11 2:05
Malli_S8-Nov-11 2:05 
AnswerRe: if(NULL == MyPointer) Pin
Eytukan8-Nov-11 8:36
Eytukan8-Nov-11 8:36 
GeneralRe: if(NULL == MyPointer) Pin
Chuck O'Toole8-Nov-11 9:39
Chuck O'Toole8-Nov-11 9:39 
GeneralRe: if(NULL == MyPointer) Pin
David Crow8-Nov-11 9:44
David Crow8-Nov-11 9:44 
GeneralRe: if(NULL == MyPointer) Pin
Stefan_Lang10-Nov-11 4:54
Stefan_Lang10-Nov-11 4:54 
GeneralRe: if(NULL == MyPointer) Pin
Eytukan10-Nov-11 18:03
Eytukan10-Nov-11 18:03 

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.