Click here to Skip to main content
15,899,026 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Always on top (modeless) dialog box Pin
Hadi Dayvary8-Nov-11 7:03
professionalHadi Dayvary8-Nov-11 7:03 
GeneralRe: Always on top (modeless) dialog box Pin
David Crow8-Nov-11 8:43
David Crow8-Nov-11 8:43 
GeneralRe: Always on top (modeless) dialog box Pin
Hadi Dayvary8-Nov-11 19:40
professionalHadi Dayvary8-Nov-11 19:40 
AnswerRe: Always on top (modeless) dialog box Pin
basementman8-Nov-11 4:37
basementman8-Nov-11 4:37 
GeneralRe: Always on top (modeless) dialog box Pin
Hadi Dayvary8-Nov-11 7:06
professionalHadi Dayvary8-Nov-11 7:06 
QuestionCalling DLL methods related problem Pin
Member 83440907-Nov-11 19:31
Member 83440907-Nov-11 19:31 
AnswerRe: Calling DLL methods related problem Pin
Richard MacCutchan7-Nov-11 22:38
mveRichard MacCutchan7-Nov-11 22:38 
Questionreturning std::pair<> Pin
User 5838527-Nov-11 17:47
User 5838527-Nov-11 17: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 18:49
Chuck O'Toole7-Nov-11 18:49 
GeneralRe: returning std::pair Pin
Erudite_Eric7-Nov-11 21:30
Erudite_Eric7-Nov-11 21:30 
GeneralRe: returning std::pair Pin
User 5838527-Nov-11 22:05
User 5838527-Nov-11 22:05 
GeneralRe: returning std::pair Pin
Malli_S8-Nov-11 1:39
Malli_S8-Nov-11 1:39 
GeneralRe: returning std::pair Pin
Albert Holguin9-Nov-11 9:30
professionalAlbert Holguin9-Nov-11 9:30 
AnswerRe: returning std::pair Pin
jschell8-Nov-11 9:58
jschell8-Nov-11 9:58 
Questionif(NULL == MyPointer) Pin
User 5838527-Nov-11 15:37
User 5838527-Nov-11 15:37 
AnswerRe: if(NULL == MyPointer) Pin
Dr.Walt Fair, PE7-Nov-11 15:45
professionalDr.Walt Fair, PE7-Nov-11 15:45 
AnswerRe: if(NULL == MyPointer) Pin
Chuck O'Toole7-Nov-11 17:43
Chuck O'Toole7-Nov-11 17:43 
AnswerRe: if(NULL == MyPointer) Pin
«_Superman_»7-Nov-11 18:08
professional«_Superman_»7-Nov-11 18:08 
GeneralRe: if(NULL == MyPointer) Pin
Stefan_Lang10-Nov-11 3:46
Stefan_Lang10-Nov-11 3:46 
AnswerRe: if(NULL == MyPointer) Pin
Malli_S8-Nov-11 1:05
Malli_S8-Nov-11 1:05 
AnswerRe: if(NULL == MyPointer) Pin
Eytukan8-Nov-11 7:36
Eytukan8-Nov-11 7:36 
GeneralRe: if(NULL == MyPointer) Pin
Chuck O'Toole8-Nov-11 8:39
Chuck O'Toole8-Nov-11 8:39 
GeneralRe: if(NULL == MyPointer) Pin
David Crow8-Nov-11 8:44
David Crow8-Nov-11 8:44 
GeneralRe: if(NULL == MyPointer) Pin
Stefan_Lang10-Nov-11 3:54
Stefan_Lang10-Nov-11 3:54 
GeneralRe: if(NULL == MyPointer) Pin
Eytukan10-Nov-11 17:03
Eytukan10-Nov-11 17: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.