ptr_fun() creates a functor from a pointer to a function. If the function pointer is to an overloaded type, you must specify the types using template arguments starting with the first argument. It is not necessary to supply the return type.
More...
|
template<typename T_return , typename... T_args> |
decltype(auto) | sigc::ptr_fun (T_return(* func)(T_args...)) |
| Creates a functor of type sigc::pointer_functor which wraps an existing non-member function. More...
|
|
ptr_fun() creates a functor from a pointer to a function. If the function pointer is to an overloaded type, you must specify the types using template arguments starting with the first argument. It is not necessary to supply the return type.
- Example:
- Example:
void foo(int) {}
void foo(float) {}
void foo(int, int) {}
sigc::slot<void(long)> sl = sigc::ptr_fun<void, int>(&foo);
ptr_fun() can also be used to convert a pointer to a static member function to a functor, like so:
- Example:
struct foo
{
static void bar(int) {}
};
◆ ptr_fun()
template <typename T_return , typename... T_args>
decltype(auto) sigc::ptr_fun |
( |
T_return(*)(T_args...) |
func | ) |
|
|
inline |
Creates a functor of type sigc::pointer_functor which wraps an existing non-member function.
- Parameters
-
func | Pointer to function that should be wrapped. |
- Returns
- Functor that executes func on invocation.
decltype(auto) ptr_fun(T_return(*func)(T_args...))
Creates a functor of type sigc::pointer_functor which wraps an existing non-member function.
Definition: ptr_fun.h:108