Imported Upstream version 2.99.2
[platform/upstream/libsigc++.git] / docs / reference / html / group__retype.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <meta name="generator" content="Doxygen 1.8.9.1"/>
7 <title>libsigc++: retype(), retype_return()</title>
8 <link href="tabs.css" rel="stylesheet" type="text/css"/>
9 <script type="text/javascript" src="jquery.js"></script>
10 <script type="text/javascript" src="dynsections.js"></script>
11 <link href="doxygen.css" rel="stylesheet" type="text/css" />
12 <link href="doxygen-extra.css" rel="stylesheet" type="text/css"/>
13 </head>
14 <body>
15 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
16 <div id="titlearea">
17 <table cellspacing="0" cellpadding="0">
18  <tbody>
19  <tr style="height: 56px;">
20   <td style="padding-left: 0.5em;">
21    <div id="projectname">libsigc++
22    &#160;<span id="projectnumber">2.99.2</span>
23    </div>
24   </td>
25  </tr>
26  </tbody>
27 </table>
28 </div>
29 <!-- end header part -->
30 <!-- Generated by Doxygen 1.8.9.1 -->
31   <div id="navrow1" class="tabs">
32     <ul class="tablist">
33       <li><a href="index.html"><span>Main&#160;Page</span></a></li>
34       <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
35       <li><a href="modules.html"><span>Modules</span></a></li>
36       <li><a href="namespaces.html"><span>Namespaces</span></a></li>
37       <li><a href="annotated.html"><span>Classes</span></a></li>
38     </ul>
39   </div>
40 </div><!-- top -->
41 <div class="header">
42   <div class="summary">
43 <a href="#nested-classes">Classes</a> &#124;
44 <a href="#func-members">Functions</a>  </div>
45   <div class="headertitle">
46 <div class="title">retype(), retype_return()<div class="ingroups"><a class="el" href="group__adaptors.html">Adaptors</a></div></div>  </div>
47 </div><!--header-->
48 <div class="contents">
49
50 <p><a class="el" href="group__retype.html#gab267b6108e8c758965d6d6e367549478" title="Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed...">sigc::retype()</a> alters a <a class="el" href="classsigc_1_1pointer__functor.html" title="pointer_functor wraps existing non-member functions with, or without, arguments. ">sigc::pointer_functor</a>, a <a class="el" href="classsigc_1_1mem__functor.html">sigc::mem_functor</a> or a <a class="el" href="classsigc_1_1slot.html" title="Converts an arbitrary functor to a unified type which is opaque. ">sigc::slot</a> in that it makes C-style casts to the functor's parameter types of all parameters passed through operator()().  
51 <a href="#details">More...</a></p>
52 <table class="memberdecls">
53 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
54 Classes</h2></td></tr>
55 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1retype__functor.html">sigc::retype_functor&lt; T_functor, T_type &gt;</a></td></tr>
56 <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adaptor that performs C-style casts on the parameters passed on to the functor.  <a href="structsigc_1_1retype__functor.html#details">More...</a><br /></td></tr>
57 <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
58 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1retype__return__functor.html">sigc::retype_return_functor&lt; T_return, T_functor &gt;</a></td></tr>
59 <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adaptor that performs a C-style cast on the return value of a functor.  <a href="structsigc_1_1retype__return__functor.html#details">More...</a><br /></td></tr>
60 <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
61 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1retype__return__functor_3_01void_00_01T__functor_01_4.html">sigc::retype_return_functor&lt; void, T_functor &gt;</a></td></tr>
62 <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adaptor that performs a C-style cast on the return value of a functor.  <a href="structsigc_1_1retype__return__functor_3_01void_00_01T__functor_01_4.html#details">More...</a><br /></td></tr>
63 <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
64 </table><table class="memberdecls">
65 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
66 Functions</h2></td></tr>
67 <tr class="memitem:gab267b6108e8c758965d6d6e367549478"><td class="memTemplParams" colspan="2">template&lt;template&lt; class T_func, class...T_arg &gt; class T_functor, class T_func , class... T_arg&gt; </td></tr>
68 <tr class="memitem:gab267b6108e8c758965d6d6e367549478"><td class="memTemplItemLeft" align="right" valign="top">decltype(auto)&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__retype.html#gab267b6108e8c758965d6d6e367549478">sigc::retype</a> (const T_functor&lt; T_func, T_arg...&gt;&amp; _A_functor)</td></tr>
69 <tr class="memdesc:gab267b6108e8c758965d6d6e367549478"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an adaptor of type <a class="el" href="structsigc_1_1retype__functor.html" title="Adaptor that performs C-style casts on the parameters passed on to the functor. ">sigc::retype_functor</a> which performs C-style casts on the parameters passed on to the functor.  <a href="#gab267b6108e8c758965d6d6e367549478">More...</a><br /></td></tr>
70 <tr class="separator:gab267b6108e8c758965d6d6e367549478"><td class="memSeparator" colspan="2">&#160;</td></tr>
71 <tr class="memitem:ga5b0a57193130457a1840fb76c1df9359"><td class="memTemplParams" colspan="2">template&lt;template&lt; class T_return, class...T_arg &gt; class T_functor, class T_return , class... T_arg&gt; </td></tr>
72 <tr class="memitem:ga5b0a57193130457a1840fb76c1df9359"><td class="memTemplItemLeft" align="right" valign="top">decltype(auto)&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__retype.html#ga5b0a57193130457a1840fb76c1df9359">sigc::retype</a> (const T_functor&lt; T_return(T_arg...)&gt;&amp; _A_functor)</td></tr>
73 <tr class="memdesc:ga5b0a57193130457a1840fb76c1df9359"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an adaptor of type <a class="el" href="structsigc_1_1retype__functor.html" title="Adaptor that performs C-style casts on the parameters passed on to the functor. ">sigc::retype_functor</a> which performs C-style casts on the parameters passed on to the functor.  <a href="#ga5b0a57193130457a1840fb76c1df9359">More...</a><br /></td></tr>
74 <tr class="separator:ga5b0a57193130457a1840fb76c1df9359"><td class="memSeparator" colspan="2">&#160;</td></tr>
75 <tr class="memitem:ga23a8cdbc12c57fbef0866b5c51d71588"><td class="memTemplParams" colspan="2">template&lt;class T_return , class T_functor &gt; </td></tr>
76 <tr class="memitem:ga23a8cdbc12c57fbef0866b5c51d71588"><td class="memTemplItemLeft" align="right" valign="top">retype_return_functor&lt; T_return, T_functor &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__retype.html#ga23a8cdbc12c57fbef0866b5c51d71588">sigc::retype_return</a> (const T_functor&amp; _A_functor)</td></tr>
77 <tr class="memdesc:ga23a8cdbc12c57fbef0866b5c51d71588"><td class="mdescLeft">&#160;</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 performs a C-style cast on the return value of the passed functor.  <a href="#ga23a8cdbc12c57fbef0866b5c51d71588">More...</a><br /></td></tr>
78 <tr class="separator:ga23a8cdbc12c57fbef0866b5c51d71588"><td class="memSeparator" colspan="2">&#160;</td></tr>
79 </table>
80 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
81 <p><a class="el" href="group__retype.html#gab267b6108e8c758965d6d6e367549478" title="Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed...">sigc::retype()</a> alters a <a class="el" href="classsigc_1_1pointer__functor.html" title="pointer_functor wraps existing non-member functions with, or without, arguments. ">sigc::pointer_functor</a>, a <a class="el" href="classsigc_1_1mem__functor.html">sigc::mem_functor</a> or a <a class="el" href="classsigc_1_1slot.html" title="Converts an arbitrary functor to a unified type which is opaque. ">sigc::slot</a> in that it makes C-style casts to the functor's parameter types of all parameters passed through operator()(). </p>
82 <p>Use this adaptor for inline conversion between numeric or other simple types. </p><dl class="section user"><dt>Example:</dt><dd><div class="fragment"><div class="line"><span class="keywordtype">void</span> foo(<span class="keywordtype">int</span>);</div>
83 <div class="line"><a class="code" href="group__retype.html#gab267b6108e8c758965d6d6e367549478">sigc::retype</a>(<a class="code" href="group__ptr__fun.html#ga203dd1ac5747cf2f3d2b2d590ad32e82">sigc::ptr_fun</a>(&amp;foo))(5.7F); <span class="comment">// calls foo(5)</span></div>
84 </div><!-- fragment --></dd></dl>
85 <p>The functor that <a class="el" href="group__retype.html#gab267b6108e8c758965d6d6e367549478" title="Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed...">sigc::retype()</a> returns can be passed directly into sigc::signal::connect().</p>
86 <dl class="section user"><dt>Example:</dt><dd><div class="fragment"><div class="line"><a class="code" href="classsigc_1_1signal.html">sigc::signal&lt;void(float)&gt;</a> some_signal;</div>
87 <div class="line"><span class="keywordtype">void</span> foo(<span class="keywordtype">int</span>);</div>
88 <div class="line">some_signal.connect(<a class="code" href="group__retype.html#gab267b6108e8c758965d6d6e367549478">sigc::retype</a>(<a class="code" href="group__ptr__fun.html#ga203dd1ac5747cf2f3d2b2d590ad32e82">sigc::ptr_fun</a>(&amp;foo)));</div>
89 </div><!-- fragment --></dd></dl>
90 <p>This adaptor builds an exception in that it only works on sig::pointer_functor, <a class="el" href="classsigc_1_1mem__functor.html">sigc::mem_functor</a> and <a class="el" href="classsigc_1_1slot.html" title="Converts an arbitrary functor to a unified type which is opaque. ">sigc::slot</a> because it needs sophisticated information about the parameter types that cannot be deduced from arbitrary functor types.</p>
91 <p><a class="el" href="group__retype.html#ga23a8cdbc12c57fbef0866b5c51d71588" title="Creates an adaptor of type sigc::retype_return_functor which performs a C-style cast on the return va...">sigc::retype_return()</a> alters the return type of an arbitrary functor. Like in <a class="el" href="group__retype.html#gab267b6108e8c758965d6d6e367549478" title="Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed...">sigc::retype()</a> a C-style cast is performed. Usage <a class="el" href="group__retype.html#ga23a8cdbc12c57fbef0866b5c51d71588" title="Creates an adaptor of type sigc::retype_return_functor which performs a C-style cast on the return va...">sigc::retype_return()</a> is not restricted to libsigc++ functor types but you need to specify the new return type as a template parameter.</p>
92 <dl class="section user"><dt>Example:</dt><dd><div class="fragment"><div class="line"><span class="keywordtype">float</span> foo();</div>
93 <div class="line">std::cout &lt;&lt; sigc::retype_return&lt;int&gt;(&amp;foo)(); <span class="comment">// converts foo&#39;s return value to an integer</span></div>
94 </div><!-- fragment --> </dd></dl>
95 <h2 class="groupheader">Function Documentation</h2>
96 <a class="anchor" id="gab267b6108e8c758965d6d6e367549478"></a>
97 <div class="memitem">
98 <div class="memproto">
99 <div class="memtemplate">
100 template &lt;template&lt; class T_func, class...T_arg &gt; class T_functor, class T_func , class... T_arg&gt; </div>
101 <table class="mlabels">
102   <tr>
103   <td class="mlabels-left">
104       <table class="memname">
105         <tr>
106           <td class="memname">decltype(auto) sigc::retype </td>
107           <td>(</td>
108           <td class="paramtype">const T_functor&lt; T_func, T_arg...&gt; &amp;&#160;</td>
109           <td class="paramname"><em>_A_functor</em></td><td>)</td>
110           <td></td>
111         </tr>
112       </table>
113   </td>
114   <td class="mlabels-right">
115 <span class="mlabels"><span class="mlabel">inline</span></span>  </td>
116   </tr>
117 </table>
118 </div><div class="memdoc">
119
120 <p>Creates an adaptor of type <a class="el" href="structsigc_1_1retype__functor.html" title="Adaptor that performs C-style casts on the parameters passed on to the functor. ">sigc::retype_functor</a> which performs C-style casts on the parameters passed on to the functor. </p>
121 <dl class="params"><dt>Parameters</dt><dd>
122   <table class="params">
123     <tr><td class="paramname">_A_functor</td><td>Functor that should be wrapped. </td></tr>
124   </table>
125   </dd>
126 </dl>
127 <dl class="section return"><dt>Returns</dt><dd>Adaptor that executes <em>_A_functor</em> performing C-style casts on the paramters passed on. </dd></dl>
128
129 </div>
130 </div>
131 <a class="anchor" id="ga5b0a57193130457a1840fb76c1df9359"></a>
132 <div class="memitem">
133 <div class="memproto">
134 <div class="memtemplate">
135 template &lt;template&lt; class T_return, class...T_arg &gt; class T_functor, class T_return , class... T_arg&gt; </div>
136 <table class="mlabels">
137   <tr>
138   <td class="mlabels-left">
139       <table class="memname">
140         <tr>
141           <td class="memname">decltype(auto) sigc::retype </td>
142           <td>(</td>
143           <td class="paramtype">const T_functor&lt; T_return(T_arg...)&gt; &amp;&#160;</td>
144           <td class="paramname"><em>_A_functor</em></td><td>)</td>
145           <td></td>
146         </tr>
147       </table>
148   </td>
149   <td class="mlabels-right">
150 <span class="mlabels"><span class="mlabel">inline</span></span>  </td>
151   </tr>
152 </table>
153 </div><div class="memdoc">
154
155 <p>Creates an adaptor of type <a class="el" href="structsigc_1_1retype__functor.html" title="Adaptor that performs C-style casts on the parameters passed on to the functor. ">sigc::retype_functor</a> which performs C-style casts on the parameters passed on to the functor. </p>
156 <dl class="params"><dt>Parameters</dt><dd>
157   <table class="params">
158     <tr><td class="paramname">_A_functor</td><td>Functor that should be wrapped. </td></tr>
159   </table>
160   </dd>
161 </dl>
162 <dl class="section return"><dt>Returns</dt><dd>Adaptor that executes <em>_A_functor</em> performing C-style casts on the paramters passed on. </dd></dl>
163
164 </div>
165 </div>
166 <a class="anchor" id="ga23a8cdbc12c57fbef0866b5c51d71588"></a>
167 <div class="memitem">
168 <div class="memproto">
169 <div class="memtemplate">
170 template &lt;class T_return , class T_functor &gt; </div>
171 <table class="mlabels">
172   <tr>
173   <td class="mlabels-left">
174       <table class="memname">
175         <tr>
176           <td class="memname">retype_return_functor&lt;T_return, T_functor&gt; sigc::retype_return </td>
177           <td>(</td>
178           <td class="paramtype">const T_functor &amp;&#160;</td>
179           <td class="paramname"><em>_A_functor</em></td><td>)</td>
180           <td></td>
181         </tr>
182       </table>
183   </td>
184   <td class="mlabels-right">
185 <span class="mlabels"><span class="mlabel">inline</span></span>  </td>
186   </tr>
187 </table>
188 </div><div class="memdoc">
189
190 <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 performs a C-style cast on the return value of the passed functor. </p>
191 <p>The template argument <em>T_return</em> specifies the target type of the cast.</p>
192 <dl class="params"><dt>Parameters</dt><dd>
193   <table class="params">
194     <tr><td class="paramname">_A_functor</td><td>Functor that should be wrapped. </td></tr>
195   </table>
196   </dd>
197 </dl>
198 <dl class="section return"><dt>Returns</dt><dd>Adaptor that executes <em>_A_functor</em> performing a C-style cast on the return value. </dd></dl>
199
200 </div>
201 </div>
202 </div><!-- contents -->
203 <!-- start footer part -->
204 <hr class="footer"/><address class="footer"><small>
205 Generated on Wed Mar 16 2016 20:53:27 for libsigc++ by &#160;<a href="http://www.doxygen.org/index.html">
206 <img class="footer" src="doxygen.png" alt="doxygen"/>
207 </a> 1.8.9.1
208 </small></address>
209 </body>
210 </html>