libsigc++ 3.6.0
Classes | Functions
ptr_fun()

ptr_fun() creates a functor from a pointer to a function. More...

Classes

class  sigc::pointer_functor< T_return, T_args >
 pointer_functor wraps existing non-member functions with, or without, arguments. More...
 

Functions

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.
 

Detailed Description

ptr_fun() creates a functor from a pointer to a function.

Example:
void foo(int) {}
sigc::slot<void(int)> sl = sigc::ptr_fun(&foo);
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:107

If the function pointer is to an overloaded type, you must specify the types using template arguments.

Example:
void foo(int) {} // choose this one
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) {}
};
sigc::slot<void(int)> sl = sigc::ptr_fun(&foo::bar);

Function Documentation

◆ 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
funcPointer to function that should be wrapped.
Returns
Functor that executes func on invocation.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy