libsigc++ 3.6.0
Classes | Functions
hide(), hide_return()

sigc::hide() alters an arbitrary functor in that it adds a parameter whose value is ignored on invocation of the returned functor. More...

Classes

struct  sigc::hide_functor< I_location, T_functor >
 Adaptor that adds a dummy parameter to the wrapped functor. More...
 

Functions

template <int I_location, typename T_functor >
decltype(autosigc::hide (const T_functor &func)
 Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor.
 
template <typename T_functor >
decltype(autosigc::hide (const T_functor &func)
 Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor.
 
template <typename T_functor >
retype_return_functor< void, T_functor > sigc::hide_return (const T_functor &functor)
 Creates an adaptor of type sigc::retype_return_functor which drops the return value of the passed functor.
 

Detailed Description

sigc::hide() alters an arbitrary functor in that it adds a parameter whose value is ignored on invocation of the returned functor.

Thus you can discard one argument of a signal.

You may optionally specify the zero-based position of the parameter to ignore as a template argument. The default is to ignore the last parameter. (A value of -1 adds a parameter at the end so sigc::hide<-1>() gives the same result as sigc::hide().)

The type of the parameter can optionally be specified if not deduced.

Examples:
void foo(int, int);
// single argument hiding ...
sigc::hide(&foo)(1,2,3); // adds a dummy parameter at the back and calls foo(1,2)
sigc::hide<-1>(&foo)(1,2,3); // same as sigc::hide(&foo)(1,2,3) (calls foo(1,2))
sigc::hide<0>(&foo)(1,2,3); // adds a dummy parameter at the beginning and calls foo(2,3)
sigc::hide<1>(&foo)(1,2,3); // adds a dummy parameter in the middle and calls foo(1,3)
sigc::hide<2>(&foo)(1,2,3); // adds a dummy parameter at the back and calls foo(1,2)
decltype(auto) hide(const T_functor &func)
Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor.
Definition hide.h:144
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

The functor that sigc::hide() returns can be passed directly into sigc::signal::connect() or sigc::signal::connect_first().

Example:
sigc::signal<void(int)> some_signal;
void foo();

sigc::hide() can be nested in order to discard multiple arguments.

Example:
// multiple argument hiding ...
// adds two dummy parameters at the back and calls foo(1,2)

sigc::hide_return() alters an arbitrary functor by dropping its return value, thus converting it to a void functor.

Function Documentation

◆ hide() [1/2]

template <int I_location, typename T_functor >
decltype(auto) sigc::hide ( const T_functor &  func)
inline

Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor.

The optional template argument I_location specifies the zero-based position of the dummy parameter in the returned functor (-1 stands for the last parameter).

Parameters
funcFunctor that should be wrapped.
Returns
Adaptor that executes func, ignoring the value of the dummy parameter.

◆ hide() [2/2]

template <typename T_functor >
decltype(auto) sigc::hide ( const T_functor &  func)
inline

Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor.

This overload adds a dummy parameter at the back of the functor's parameter list.

Parameters
funcFunctor that should be wrapped.
Returns
Adaptor that executes func, ignoring the value of the last parameter.

◆ hide_return()

template <typename T_functor >
retype_return_functor< void, T_functor > sigc::hide_return ( const T_functor &  functor)
inline

Creates an adaptor of type sigc::retype_return_functor which drops the return value of the passed functor.

Parameters
functorFunctor that should be wrapped.
Returns
Adaptor that executes functor dropping its return value.
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