<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>libzypp: zypp::functor::functor_detail Namespace Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">libzypp  <span id="projectnumber">17.9.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',false,false,'search.php','Search'); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('namespacezypp_1_1functor_1_1functor__detail.html','');}); /* @license-end */ </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> </div> <div class="headertitle"> <div class="title">zypp::functor::functor_detail Namespace Reference<div class="ingroups"><a class="el" href="group__g__Functor.html">Filters and Functors</a></div></div> </div> </div><!--header--> <div class="contents"> <p>An unary functor forwarding to some other <code>TFunctor &</code>. <a href="#details">More...</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Classes</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structzypp_1_1functor_1_1functor__detail_1_1FunctorRef0.html">FunctorRef0</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structzypp_1_1functor_1_1functor__detail_1_1FunctorRef1.html">FunctorRef1</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structzypp_1_1functor_1_1functor__detail_1_1FunctorRef2.html">FunctorRef2</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structzypp_1_1functor_1_1functor__detail_1_1nil.html">nil</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>An unary functor forwarding to some other <code>TFunctor &</code>. </p> <p>Most algorithms take functor arguments by value. That's inconvenient if the functor wants to collect and return data. Creating and passing a <a class="el" href="structzypp_1_1functor_1_1FunctorRef.html">FunctorRef</a> to the algorithm, may help you out of this.</p> <div class="fragment"><div class="line"><span class="comment">// Counts invokations of operator().</span></div><div class="line"><span class="keyword">template</span><<span class="keyword">class</span> Tp></div><div class="line"> <span class="keyword">struct </span>Counter : <span class="keyword">public</span> std::unary_function<Tp, void></div><div class="line"> {</div><div class="line"> <span class="keywordtype">void</span> operator()( Tp )</div><div class="line"> { ++<a class="code" href="SysContent_8cc.html#a5566eab00fc081a74f536939218937ad">_value</a>; }</div><div class="line"></div><div class="line"> Counter() : <a class="code" href="SysContent_8cc.html#a5566eab00fc081a74f536939218937ad">_value</a>( 0 ) {}</div><div class="line"></div><div class="line"> <span class="keywordtype">unsigned</span> <a class="code" href="SysContent_8cc.html#a5566eab00fc081a74f536939218937ad">_value</a>;</div><div class="line"> };</div><div class="line"></div><div class="line">std::set<SomeType> c;</div><div class="line">Counter<SomeType> counter;</div><div class="line"><span class="comment">// Invokations of FunctorRef are forwarded to counter:</span></div><div class="line">std::for_each( c.begin, c.end(),</div><div class="line"> <span class="comment">// currently you must specify the</span></div><div class="line"> <span class="comment">// operator() signature:</span></div><div class="line"> functorRef<void,SomeType>(counter)</div><div class="line"> );</div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd><a class="el" href="structzypp_1_1functor_1_1FunctorRef.html" title="A binary FunctorRef.">FunctorRef</a> must be able to deduce the signature of <code>TFunctor::operator()</code>. This is currently not automated, so you must specify the operator() signature as template arguments.</dd> <dd> The order is <result_type, arg1_type, ...> (this differs from std::, where the result comes last).</dd></dl> <dl class="todo"><dt><b><a class="el" href="todo.html#_todo000006">Todo:</a></b></dt><dd>drop it an use boost::ref </dd></dl> </div></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="namespacezypp.html">zypp</a></li><li class="navelem"><a class="el" href="namespacezypp_1_1functor.html">functor</a></li><li class="navelem"><a class="el" href="namespacezypp_1_1functor_1_1functor__detail.html">functor_detail</a></li> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li> </ul> </div> </body> </html>