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

C / C++ / MFC

 
AnswerRe: The header file process.h Pin
Aescleal28-Aug-10 5:00
Aescleal28-Aug-10 5:00 
GeneralRe: The header file process.h Pin
Sauro Viti28-Aug-10 6:00
professionalSauro Viti28-Aug-10 6:00 
GeneralRe: The header file process.h Pin
Paul Michalik29-Aug-10 1:07
Paul Michalik29-Aug-10 1:07 
Questionhow do I handle the VSCROLL from CMFCRibbonEdit on ribbon in CMainFrame? Pin
andrewxiang27-Aug-10 17:58
andrewxiang27-Aug-10 17:58 
QuestionHow to declare pointer to member function Pin
Danzy8327-Aug-10 14:02
Danzy8327-Aug-10 14:02 
AnswerRe: How to declare pointer to member function Pin
Luc Pattyn27-Aug-10 15:08
sitebuilderLuc Pattyn27-Aug-10 15:08 
AnswerRe: How to declare pointer to member function Pin
wsauer27-Aug-10 18:12
wsauer27-Aug-10 18:12 
GeneralRe: How to declare pointer to member function Pin
Aescleal27-Aug-10 20:19
Aescleal27-Aug-10 20:19 
Member function pointers are really handy when you want to call the same member function on every element of a collection. It's either that or write a shim functor to do the call for you. So instead of:

class functor
{
    public:
        void operator()( object &obj )
        {
            obj.A();
        }
};

std::for_each( data.begin(), data.end(), functor() );


you can use:

std::for_each( data.begin(), data.end(), std::mem_fun_ref( &object::A ) );


The first form is a real pain in the neck before C++0x as you can't define a local class or use a lamda. Your functor has to be defined "somewhere else" which can lead to a bit of flow interruption when you're reading code (for me anyway, your experience probably differs).

Cheers,

Ash

PS: Pedants please note my argument may not apply if...
- I'm not using a pointer, just taking the address of a member function
- I'm using someone else's (i.e. the standard library's)
GeneralRe: How to declare pointer to member function Pin
Niklas L27-Aug-10 21:15
Niklas L27-Aug-10 21:15 
GeneralRe: How to declare pointer to member function Pin
Aescleal27-Aug-10 22:21
Aescleal27-Aug-10 22:21 
AnswerRe: How to declare pointer to member function Pin
«_Superman_»27-Aug-10 18:20
professional«_Superman_»27-Aug-10 18:20 
AnswerRe: How to declare pointer to member function Pin
Paul Michalik28-Aug-10 0:55
Paul Michalik28-Aug-10 0:55 
GeneralRe: How to declare pointer to member function Pin
Aescleal28-Aug-10 4:52
Aescleal28-Aug-10 4:52 
GeneralRe: How to declare pointer to member function Pin
Paul Michalik28-Aug-10 9:52
Paul Michalik28-Aug-10 9:52 
GeneralRe: How to declare pointer to member function Pin
Aescleal28-Aug-10 11:10
Aescleal28-Aug-10 11:10 
GeneralRe: How to declare pointer to member function Pin
Paul Michalik28-Aug-10 21:40
Paul Michalik28-Aug-10 21:40 
QuestionAfxGetMainWnd() returns the window of another application!!!! Pin
VCSharp00727-Aug-10 0:08
VCSharp00727-Aug-10 0:08 
Questionwindow controls are not getting resized while dragging the window Pin
arun_pk27-Aug-10 0:04
arun_pk27-Aug-10 0:04 
AnswerRe: window controls are not getting resized while dragging the window Pin
Cool_Dev27-Aug-10 2:24
Cool_Dev27-Aug-10 2:24 
AnswerRe: window controls are not getting resized while dragging the window Pin
David Crow27-Aug-10 6:46
David Crow27-Aug-10 6:46 
QuestionProblem in binary file writing Pin
ganesh_IT26-Aug-10 23:52
ganesh_IT26-Aug-10 23:52 
AnswerRe: Problem in binary file writing Pin
Sauro Viti27-Aug-10 0:01
professionalSauro Viti27-Aug-10 0:01 
QuestionBinary file read writing problem Pin
ganesh_IT26-Aug-10 23:46
ganesh_IT26-Aug-10 23:46 
AnswerRe: Binary file read writing problem Pin
CPallini26-Aug-10 23:51
mveCPallini26-Aug-10 23:51 
AnswerRe: Binary file read writing problem Pin
ThatsAlok29-Aug-10 20:59
ThatsAlok29-Aug-10 20:59 

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.