libsigc++ 2.0: ptr_fun()

Main Page Groups Namespaces

# ptr_fun()
[Functors]

Collaboration diagram for ptr_fun():

ptr_fun() is used to convert a pointer to a function to a functor. More...

## Classes
class | sigc::pointer_functor0<T_return>
| pointer_functor0 wraps existing non-member functions with 0 argument(s). More...
class | sigc::pointer_functor1<T_arg1, T_return>
| pointer_functor1 wraps existing non-member functions with 1 argument(s). More...
class | sigc::pointer_functor2<T_arg1, T_arg2, T_return>
| pointer_functor2 wraps existing non-member functions with 2 argument(s). More...
class | sigc::pointer_functor3<T_arg1, T_arg2, T_arg3, T_return>
| pointer_functor3 wraps existing non-member functions with 3 argument(s). More...
class | sigc::pointer_functor4<T_arg1, T_arg2, T_arg3, T_arg4, T_return>
| pointer_functor4 wraps existing non-member functions with 4 argument(s). More...
class | sigc::pointer_functor5<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_return>
| pointer_functor5 wraps existing non-member functions with 5 argument(s). More...
class | sigc::pointer_functor6<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_return>
| pointer_functor6 wraps existing non-member functions with 6 argument(s). More...
class | sigc::pointer_functor7<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7, T_return>
| pointer_functor7 wraps existing non-member functions with 7 argument(s). More...
## Functions
template<class T_return>
pointer_functor0 <T_return> | sigc::ptr_fun0 (T_return(* _A_func)())
| Creates a functor of type sigc::pointer_functor0 which wraps an existing non-member function.
template<class T_arg1, class T_return>
pointer_functor1 <T_arg1, T_return> | sigc::ptr_fun1 (T_return(* _A_func)(T_arg1))
| Creates a functor of type sigc::pointer_functor1 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_return>
pointer_functor2 < T_arg1, T_arg2, T_return > | sigc::ptr_fun2 (T_return(* _A_func)(T_arg1, T_arg2))
| Creates a functor of type sigc::pointer_functor2 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_return>
pointer_functor3 < T_arg1, T_arg2, T_arg3, T_return > | sigc::ptr_fun3 (T_return(* _A_func)(T_arg1, T_arg2, T_arg3))
| Creates a functor of type sigc::pointer_functor3 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_return>
pointer_functor4 < T_arg1, T_arg2, T_arg3, T_arg4, T_return > | sigc::ptr_fun4 (T_return(* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4))
| Creates a functor of type sigc::pointer_functor4 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_return>
pointer_functor5 < T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_return > | sigc::ptr_fun5 (T_return(* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5))
| Creates a functor of type sigc::pointer_functor5 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_return>
pointer_functor6 < T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_return > | sigc::ptr_fun6 (T_return(* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6))
| Creates a functor of type sigc::pointer_functor6 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_arg7, class T_return>
pointer_functor7 < T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7, T_return > | sigc::ptr_fun7 (T_return(* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7))
| Creates a functor of type sigc::pointer_functor7 which wraps an existing non-member function.
template<class T_return>
pointer_functor0 <T_return> | sigc::ptr_fun (T_return(* _A_func)())
| Creates a functor of type sigc::pointer_functor0 which wraps an existing non-member function.
template<class T_arg1, class T_return>
pointer_functor1 <T_arg1, T_return> | sigc::ptr_fun (T_return(* _A_func)(T_arg1))
| Creates a functor of type sigc::pointer_functor1 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_return>
pointer_functor2 < T_arg1, T_arg2, T_return > | sigc::ptr_fun (T_return(* _A_func)(T_arg1, T_arg2))
| Creates a functor of type sigc::pointer_functor2 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_return>
pointer_functor3 < T_arg1, T_arg2, T_arg3, T_return > | sigc::ptr_fun (T_return(* _A_func)(T_arg1, T_arg2, T_arg3))
| Creates a functor of type sigc::pointer_functor3 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_return>
pointer_functor4 < T_arg1, T_arg2, T_arg3, T_arg4, T_return > | sigc::ptr_fun (T_return(* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4))
| Creates a functor of type sigc::pointer_functor4 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_return>
pointer_functor5 < T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_return > | sigc::ptr_fun (T_return(* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5))
| Creates a functor of type sigc::pointer_functor5 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_return>
pointer_functor6 < T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_return > | sigc::ptr_fun (T_return(* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6))
| Creates a functor of type sigc::pointer_functor6 which wraps an existing non-member function.
template<class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_arg7, class T_return>
pointer_functor7 < T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7, T_return > | sigc::ptr_fun (T_return(* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7))
| Creates a functor of type sigc::pointer_functor7 which wraps an existing non-member function.

## Detailed Description

ptr_fun() is used to convert a pointer to a function to a functor.

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:

         void foo(int) {}
         sigc::slot<void, int> sl = sigc::ptr_fun(&foo);

Use ptr_fun#() if there is an abiguity as to the number of arguments.

Example:

         void foo(int) {}  // choose this one
         void foo(float) {}
         void foo(int, int) {}
         sigc::slot<void, long> sl = sigc::ptr_fun1<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

template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_arg7, class T_return>

pointer_functor7<T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_return> sigc::ptr_fun | ( | T_return(*)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor7 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_return>

pointer_functor6<T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_return> sigc::ptr_fun | ( | T_return(*)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor6 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_return>

pointer_functor5<T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_return> sigc::ptr_fun | ( | T_return(*)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor5 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_return>

pointer_functor4<T_arg1,T_arg2,T_arg3,T_arg4, T_return> sigc::ptr_fun | ( | T_return(*)(T_arg1, T_arg2, T_arg3, T_arg4) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor4 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_return>

pointer_functor3<T_arg1,T_arg2,T_arg3, T_return> sigc::ptr_fun | ( | T_return(*)(T_arg1, T_arg2, T_arg3) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor3 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_return>

pointer_functor2<T_arg1,T_arg2, T_return> sigc::ptr_fun | ( | T_return(*)(T_arg1, T_arg2) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor2 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_return>

pointer_functor1<T_arg1, T_return> sigc::ptr_fun | ( | T_return(*)(T_arg1) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor1 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_return>

pointer_functor0<T_return> sigc::ptr_fun | ( | T_return(*)() | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor0 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_return>

pointer_functor0<T_return> sigc::ptr_fun0 | ( | T_return(*)() | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor0 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_return>

pointer_functor1<T_arg1, T_return> sigc::ptr_fun1 | ( | T_return(*)(T_arg1) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor1 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_return>

pointer_functor2<T_arg1,T_arg2, T_return> sigc::ptr_fun2 | ( | T_return(*)(T_arg1, T_arg2) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor2 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_return>

pointer_functor3<T_arg1,T_arg2,T_arg3, T_return> sigc::ptr_fun3 | ( | T_return(*)(T_arg1, T_arg2, T_arg3) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor3 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_return>

pointer_functor4<T_arg1,T_arg2,T_arg3,T_arg4, T_return> sigc::ptr_fun4 | ( | T_return(*)(T_arg1, T_arg2, T_arg3, T_arg4) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor4 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_return>

pointer_functor5<T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_return> sigc::ptr_fun5 | ( | T_return(*)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor5 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_return>

pointer_functor6<T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_return> sigc::ptr_fun6 | ( | T_return(*)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor6 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.

template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_arg7, class T_return>

pointer_functor7<T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_return> sigc::ptr_fun7 | ( | T_return(*)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7) | _A_func | ) | `[inline]`

Creates a functor of type sigc::pointer_functor7 which wraps an existing non-member function.

Parameters:

  | _A_func | Pointer to function that should be wrapped.

Returns:
  Functor that executes _A_func on invokation.