Top "Pointer-to-member" questions

this tag is normally used with questions about creating a pointer to a non-static member function of a class in the C++ programming language.

How can I pass a member function where a free function is expected?

The question is the following: consider this piece of code: #include <iostream> class aClass { public: void aTest(int …

c++ arguments parameter-passing function-pointers pointer-to-member
Casting between void * and a pointer to member function

I'm currently using GCC 4.4, and I'm having quite the headache casting between void* and a pointer to member function. I'm …

c++ pointers lua pointer-to-member
Error with address of parenthesized member function

I found something interesting. The error message says it all. What is the reason behind not allowing parentheses while taking …

c++ function-pointers pointer-to-member
What are the Pointer-to-Member ->* and .* Operators in C++?

Yes, I've seen this question and this FAQ, but I still don't understand what ->* and .* mean in C++. …

c++ operators pointer-to-member operator-arrow-star
Using a member function pointer within a class

Given an example class: class Fred { public: Fred() { func = &Fred::fa; } void run() { int foo, bar; *func(foo,bar); } …

c++ pointer-to-member
How to print member function address in C++

It looks like std::cout can't print member function's address, for example: #include <iostream> using std::cout; using …

c++ pointers function-pointers pointer-to-member
How to get the address of an overloaded member function?

I'm trying to get a pointer to a specific version of an overloaded member function. Here's the example: class C { …

c++ overloading pointer-to-member
Where are member functions stored for an object?

I'm experimenting with C++ to understand how class/structures and their respective objects are laid out in memory and I …

c++ memory function-pointers pointer-to-member
Pointer to class member as a template parameter

I want to use a pointer to a class member as a template parameter as in: template <class Class, …

c++ templates c++11 c++14 pointer-to-member