Function pointers

I created a map of function pointers, and now i want to take the pointer and pass it as a function parameter but i get error "operant of * must be a pointer".

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
typedef void(PictureAlbum::*func)();
void handleInternalPath(void(PictureAlbum:: *f)());

std::map<std::string, func> links;
links["/index"] = &PictureAlbum::showIndex;

void PictureAlbum::handleInternalPath(void(PictureAlbum:: *f)()) {
	Wt::WApplication *app = Wt::WApplication::instance();

	if (f != NULL) {
		(*f)();
	}	
	else {

	}
}
(this->*f)();

And since you already have a typedef:
1
2
3
void handleInternalPath(func f);

void PictureAlbum::handleInternalPath(func f) {
Hi,
Here's how to call a member function pointer :
1
2
3
if (f != NULL) {
		(this->*f)();
	}
Does that help you? :)
Yes, thank you very much :D
Good to hear :)
Topic archived. No new replies allowed.