sigc::retype() alters a sigc::pointer_functor, a sigc::mem_functor or a sigc::slot in that it makes C-style casts to the functor's parameter types of all parameters passed through operator()().
More...
|
template<template< typename T_func, typename... T_arg > class T_functor, typename T_func , typename... T_arg> |
decltype(auto) | sigc::retype (const T_functor< T_func, T_arg... > & functor) |
| Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed on to the functor. More...
|
|
template<template< typename T_return, typename... T_arg > class T_functor, typename T_return , typename... T_arg> |
decltype(auto) | sigc::retype (const T_functor< T_return(T_arg...)> & functor) |
| Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed on to the functor. More...
|
|
template<typename T_return , typename T_functor > |
retype_return_functor< T_return, T_functor > | sigc::retype_return (const T_functor & functor) |
| Creates an adaptor of type sigc::retype_return_functor which performs a C-style cast on the return value of the passed functor. More...
|
|
sigc::retype() alters a sigc::pointer_functor, a sigc::mem_functor or a sigc::slot in that it makes C-style casts to the functor's parameter types of all parameters passed through operator()().
Use this adaptor for inline conversion between numeric or other simple types.
- Example:
void foo(int);
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:109
decltype(auto) retype(const T_functor< T_func, T_arg... > &functor)
Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed...
Definition: retype.h:131
The functor that sigc::retype() returns can be passed directly into sigc::signal::connect() or sigc::signal::connect_first().
- Example:
sigc::signal<void(float)> some_signal;
void foo(int);
This adaptor builds an exception in that it only works on sigc::pointer_functor, sigc::mem_functor and sigc::slot because it needs sophisticated information about the parameter types that cannot be deduced from arbitrary functor types.
sigc::retype_return() alters the return type of an arbitrary functor. Like in sigc::retype() a C-style cast is performed. Usage sigc::retype_return() is not restricted to libsigc++ functor types but you need to specify the new return type as a template parameter.
- Example:
float foo();
std::cout << sigc::retype_return<int>(&foo)();
◆ retype() [1/2]
template <template< typename T_func, typename... T_arg > class T_functor, typename T_func , typename... T_arg>
decltype(auto) sigc::retype |
( |
const T_functor< T_func, T_arg... > & |
functor | ) |
|
|
inline |
Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed on to the functor.
- Parameters
-
functor | Functor that should be wrapped. |
- Returns
- Adaptor that executes functor performing C-style casts on the paramters passed on.
◆ retype() [2/2]
template <template< typename T_return, typename... T_arg > class T_functor, typename T_return , typename... T_arg>
decltype(auto) sigc::retype |
( |
const T_functor< T_return(T_arg...)> & |
functor | ) |
|
|
inline |
Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed on to the functor.
- Parameters
-
functor | Functor that should be wrapped. |
- Returns
- Adaptor that executes functor performing C-style casts on the paramters passed on.
◆ retype_return()
template <typename T_return , typename T_functor >
Creates an adaptor of type sigc::retype_return_functor which performs a C-style cast on the return value of the passed functor.
The template argument T_return specifies the target type of the cast.
- Parameters
-
functor | Functor that should be wrapped. |
- Returns
- Adaptor that executes functor performing a C-style cast on the return value.