Click here to Skip to main content
14,028,614 members

C / C++ / MFC

 
GeneralRe: Class member function as call back Pin
NoviceEx14-Mar-19 4:01
memberNoviceEx14-Mar-19 4:01 
GeneralRe: Class member function as call back Pin
Richard MacCutchan14-Mar-19 4:05
protectorRichard MacCutchan14-Mar-19 4:05 
AnswerRe: Class member function as call back Pin
CPallini14-Mar-19 4:16
mveCPallini14-Mar-19 4:16 
AnswerRe: Class member function as call back Pin
Richard MacCutchan14-Mar-19 5:00
protectorRichard MacCutchan14-Mar-19 5:00 
GeneralRe: Class member function as call back Pin
NoviceEx14-Mar-19 21:29
memberNoviceEx14-Mar-19 21:29 
GeneralRe: Class member function as call back Pin
CPallini14-Mar-19 22:44
mveCPallini14-Mar-19 22:44 
GeneralRe: Class member function as call back Pin
Richard MacCutchan14-Mar-19 23:02
protectorRichard MacCutchan14-Mar-19 23:02 
GeneralRe: Class member function as call back Pin
CPallini15-Mar-19 1:49
mveCPallini15-Mar-19 1:49 
I think the OP cannot. Consider the following piece of code.
#include <iostream>
#include <functional>
using namespace std;


typedef void (*Callback)(int );

void invoke( Callback cb) { cb(5); }

void foo(int i) { cout << (i*2) << "\n";}


int main()
{
  foo(3); // of course you ca do this

  invoke(foo); // you can do this too

  auto bf = std::bind(foo, placeholders::_1);
  bf(7); // working bind

  std::bind(foo, 9)(); // you can even do this!

  invoke( std::bind(foo, placeholders::_1)); //<-- this doesn't compile, game over, you cannot do this
}

The last call is not allowed due to type mismatch between the bind return value and the C-like callback (I believe you might try similar code with boost).
GeneralRe: Class member function as call back Pin
Richard MacCutchan15-Mar-19 2:57
protectorRichard MacCutchan15-Mar-19 2:57 
AnswerRe: Class member function as call back Pin
Stefan_Lang19-Mar-19 4:07
memberStefan_Lang19-Mar-19 4:07 
QuestionWin32++ Dialog Pin
Member 1372187514-Mar-19 1:32
memberMember 1372187514-Mar-19 1:32 
AnswerRe: Win32++ Dialog Pin
Richard MacCutchan14-Mar-19 1:58
protectorRichard MacCutchan14-Mar-19 1:58 
GeneralRe: Win32++ Dialog Pin
CPallini14-Mar-19 2:30
mveCPallini14-Mar-19 2:30 
GeneralRe: Win32++ Dialog Pin
Richard MacCutchan14-Mar-19 2:35
protectorRichard MacCutchan14-Mar-19 2:35 
AnswerRe: Win32++ Dialog Pin
leon de boer14-Mar-19 14:34
memberleon de boer14-Mar-19 14:34 
QuestionGet file size Pin
_Flaviu14-Mar-19 0:31
member_Flaviu14-Mar-19 0:31 
AnswerRe: Get file size Pin
CPallini14-Mar-19 1:09
mveCPallini14-Mar-19 1:09 
GeneralRe: Get file size Pin
_Flaviu14-Mar-19 1:20
member_Flaviu14-Mar-19 1:20 
GeneralRe: Get file size Pin
CPallini14-Mar-19 1:24
mveCPallini14-Mar-19 1:24 
QuestionGet system image list not working in some cases Pin
_Flaviu13-Mar-19 7:07
member_Flaviu13-Mar-19 7:07 
SuggestionRe: Get system image list not working in some cases Pin
Richard MacCutchan13-Mar-19 22:18
protectorRichard MacCutchan13-Mar-19 22:18 
GeneralRe: Get system image list not working in some cases Pin
_Flaviu14-Mar-19 0:16
member_Flaviu14-Mar-19 0:16 
QuestionWrite in registry Pin
_Flaviu13-Mar-19 0:04
member_Flaviu13-Mar-19 0:04 
AnswerRe: Write in registry Pin
Richard Deeming13-Mar-19 1:41
mveRichard Deeming13-Mar-19 1:41 
GeneralRe: Write in registry Pin
_Flaviu13-Mar-19 3:53
member_Flaviu13-Mar-19 3:53 

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.


Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190419.4 | Last Updated 21 Apr 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid