<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>libsigc++: hide(), hide_return()</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <h1>hide(), hide_return()<br/> <small> [<a class="el" href="group__adaptors.html">Adaptors</a>]</small> </h1> </div> </div> <div class="contents"> <p>sigc::hide() alters an arbitrary functor in that it adds a parameter whose value is ignored on invocation of the returned functor. <a href="#_details">More...</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Classes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1hide__functor_3-1_00_01T__functor_01_4.html">sigc::hide_functor<-1, T_functor ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that adds a dummy parameter to the wrapped functor. <a href="structsigc_1_1hide__functor_3-1_00_01T__functor_01_4.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1hide__functor_3_010_00_01T__functor_01_4.html">sigc::hide_functor< 0, T_functor ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that adds a dummy parameter to the wrapped functor. <a href="structsigc_1_1hide__functor_3_010_00_01T__functor_01_4.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1hide__functor_3_011_00_01T__functor_01_4.html">sigc::hide_functor< 1, T_functor ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that adds a dummy parameter to the wrapped functor. <a href="structsigc_1_1hide__functor_3_011_00_01T__functor_01_4.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1hide__functor_3_012_00_01T__functor_01_4.html">sigc::hide_functor< 2, T_functor ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that adds a dummy parameter to the wrapped functor. <a href="structsigc_1_1hide__functor_3_012_00_01T__functor_01_4.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1hide__functor_3_013_00_01T__functor_01_4.html">sigc::hide_functor< 3, T_functor ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that adds a dummy parameter to the wrapped functor. <a href="structsigc_1_1hide__functor_3_013_00_01T__functor_01_4.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1hide__functor_3_014_00_01T__functor_01_4.html">sigc::hide_functor< 4, T_functor ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that adds a dummy parameter to the wrapped functor. <a href="structsigc_1_1hide__functor_3_014_00_01T__functor_01_4.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1hide__functor_3_015_00_01T__functor_01_4.html">sigc::hide_functor< 5, T_functor ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that adds a dummy parameter to the wrapped functor. <a href="structsigc_1_1hide__functor_3_015_00_01T__functor_01_4.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1hide__functor_3_016_00_01T__functor_01_4.html">sigc::hide_functor< 6, T_functor ></a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that adds a dummy parameter to the wrapped functor. <a href="structsigc_1_1hide__functor_3_016_00_01T__functor_01_4.html#_details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memTemplParams" colspan="2">template<class T_functor > </td></tr> <tr><td class="memTemplItemLeft" align="right" valign="top">retype_return_functor< void, <br class="typebreak"/> T_functor > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__hide.html#gad7e18e1edbbefe13216eb344bd522f0a">sigc::hide_return</a> (const T_functor& _A_functor)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an adaptor of type <a class="el" href="structsigc_1_1retype__return__functor.html" title="Adaptor that performs a C-style cast on the return value of a functor.">sigc::retype_return_functor</a> which drops the return value of the passed functor. <a href="#gad7e18e1edbbefe13216eb344bd522f0a"></a><br/></td></tr> <tr><td class="memTemplParams" colspan="2">template<class T_action , int I_location, class T_functor > </td></tr> <tr><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__hide.html#gaa07f0ffec52a12cd7dcf1601938b247c">sigc::visit_each</a> (const T_action& _A_action, const hide_functor< I_location, T_functor >& _A_target)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Performs a functor on each of the targets of a functor. <a href="#gaa07f0ffec52a12cd7dcf1601938b247c"></a><br/></td></tr> <tr><td class="memTemplParams" colspan="2">template<int I_location, class T_functor > </td></tr> <tr><td class="memTemplItemLeft" align="right" valign="top">hide_functor< I_location, <br class="typebreak"/> T_functor > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__hide.html#gaf28d43958b26c67e314f726540463c44">sigc::hide</a> (const T_functor& _A_func)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor. <a href="#gaf28d43958b26c67e314f726540463c44"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>sigc::hide() alters an arbitrary functor in that it adds a parameter whose value is ignored on invocation of the returned functor. </p> <p>Thus you can discard one argument of a signal.</p> <p>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 <code>-1</code> adds a parameter at the end so sigc::hide<-1>() gives the same result as sigc::hide().)</p> <p>The type of the parameter can optionally be specified if not deduced.</p> <dl class="user"><dt><b>Examples:</b></dt><dd><div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> foo(<span class="keywordtype">int</span>, <span class="keywordtype">int</span>); <span class="comment">// single argument hiding ...</span> <a class="code" href="group__hide.html#gaf28d43958b26c67e314f726540463c44" title="Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor...">sigc::hide</a>(&foo)(1,2,3); <span class="comment">// adds a dummy parameter at the back and calls foo(1,2)</span> <a class="code" href="group__hide.html#gaf28d43958b26c67e314f726540463c44" title="Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor...">sigc::hide</a><-1>(&foo)(1,2,3); <span class="comment">// same as sigc::hide(&foo)(1,2,3) (calls foo(1,2))</span> sigc::hide<0>(&foo)(1,2,3); <span class="comment">// adds a dummy parameter at the beginning and calls foo(2,3)</span> sigc::hide<1>(&foo)(1,2,3); <span class="comment">// adds a dummy parameter in the middle and calls foo(1,3)</span> sigc::hide<2>(&foo)(1,2,3); <span class="comment">// adds a dummy parameter at the back and calls foo(1,2)</span> </pre></div></dd></dl> <p>The functor sigc::hide() returns can be directly passed into <a class="el" href="classsigc_1_1signal7.html#adc55ac9b0f935fd87a67904022e03cb2" title="Add a slot to the list of slots.">sigc::signal::connect()</a>.</p> <dl class="user"><dt><b>Example:</b></dt><dd><div class="fragment"><pre class="fragment"> <a class="code" href="classsigc_1_1signal.html" title="Convenience wrapper for the numbered sigc::signal# templates.">sigc::signal<void,int></a> some_signal; <span class="keywordtype">void</span> foo(); some_signal.<a class="code" href="classsigc_1_1signal7.html#adc55ac9b0f935fd87a67904022e03cb2" title="Add a slot to the list of slots.">connect</a>(<a class="code" href="group__hide.html#gaf28d43958b26c67e314f726540463c44" title="Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor...">sigc::hide</a>(&foo)); </pre></div></dd></dl> <p>sigc::hide() can be nested in order to discard multiple arguments. </p> <dl class="user"><dt><b>Example:</b></dt><dd><div class="fragment"><pre class="fragment"> <span class="comment">// multiple argument hiding ...</span> <a class="code" href="group__hide.html#gaf28d43958b26c67e314f726540463c44" title="Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor...">sigc::hide</a>(<a class="code" href="group__hide.html#gaf28d43958b26c67e314f726540463c44" title="Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor...">sigc::hide</a>(&foo))(1,2,3,4); <span class="comment">// adds two dummy parameters at the back and calls foo(1,2)</span> </pre></div></dd></dl> <p>sigc::hide_return() alters an arbitrary functor by dropping its return value, thus converting it to a void functor.</p> <p>For a more powerful version of this functionality see the lambda library adaptor sigc::group() which can bind, hide and reorder arguments arbitrarily. Although sigc::group() is more flexible, sigc::hide() provides a means of hiding parameters when the total number of parameters called is variable. </p> <hr/><h2>Function Documentation</h2> <a class="anchor" id="gaf28d43958b26c67e314f726540463c44"></a><!-- doxytag: member="sigc::hide" ref="gaf28d43958b26c67e314f726540463c44" args="(const T_functor &_A_func)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template <int I_location, class T_functor > </div> <table class="memname"> <tr> <td class="memname">hide_functor<I_location, T_functor> sigc::hide </td> <td>(</td> <td class="paramtype">const T_functor & </td> <td class="paramname"> <em>_A_func</em> )</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor. </p> <p>The optional template argument <em>I_location</em> specifies the zero-based position of the dummy parameter in the returned functor (<code>-1</code> stands for the last parameter).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">_A_func</td><td>Functor that should be wrapped. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>Adaptor that executes <em>_A_func</em>, ignoring the value of the dummy parameter. </dd></dl> </div> </div> <a class="anchor" id="gad7e18e1edbbefe13216eb344bd522f0a"></a><!-- doxytag: member="sigc::hide_return" ref="gad7e18e1edbbefe13216eb344bd522f0a" args="(const T_functor &_A_functor)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template <class T_functor > </div> <table class="memname"> <tr> <td class="memname">retype_return_functor<void, T_functor> sigc::hide_return </td> <td>(</td> <td class="paramtype">const T_functor & </td> <td class="paramname"> <em>_A_functor</em> )</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Creates an adaptor of type <a class="el" href="structsigc_1_1retype__return__functor.html" title="Adaptor that performs a C-style cast on the return value of a functor.">sigc::retype_return_functor</a> which drops the return value of the passed functor. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">_A_functor</td><td>Functor that should be wrapped. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>Adaptor that executes <em>_A_functor</em> dropping its return value. </dd></dl> </div> </div> <a class="anchor" id="gaa07f0ffec52a12cd7dcf1601938b247c"></a><!-- doxytag: member="sigc::visit_each" ref="gaa07f0ffec52a12cd7dcf1601938b247c" args="(const T_action &_A_action, const hide_functor< I_location, T_functor > &_A_target)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template <class T_action , int I_location, class T_functor > </div> <table class="memname"> <tr> <td class="memname">void sigc::visit_each </td> <td>(</td> <td class="paramtype">const T_action & </td> <td class="paramname"> <em>_A_action</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const hide_functor< I_location, T_functor > & </td> <td class="paramname"> <em>_A_target</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Performs a functor on each of the targets of a functor. </p> <p>The function overload for sigc::hide_functor performs a functor on the functor stored in the sigc::hide_functor object. </p> </div> </div> </div> <hr class="footer"/><address class="footer"><small>Generated on Tue Mar 8 2011 11:44:40 for libsigc++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address> </body> </html>