<divxmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"class="refsynopsisdiv"><preclass="synopsis"><spanclass="comment">// In header: <<aclass="link"href="../reference.html#header.boost.functional.overloaded_function_hpp"title="Header <boost/functional/overloaded_function.hpp>">boost/functional/overloaded_function.hpp</a>>
<p>This function object aggregates together calls to functions of all the specified function types <codeclass="computeroutput">F1</code>, <codeclass="computeroutput">F2</code>, etc which must have distinct function signatures from one another.</p>
<td>Each function type must be specified using the following syntax (which is Boost.Function's preferred syntax): <prexmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"class="table-programlisting"><spanclass="identifier">result_type</span><spanclass="special">(</span><spanclass="identifier">argument1_type</span><spanclass="special">,</span><spanclass="identifier">argumgnet2_type</span><spanclass="special">,</span><spanclass="special">...</span><spanclass="special">)</span>
<p>In some cases, the <codeclass="computeroutput"><aclass="link"href="make_overloaded_function.html"title="Function template make_overloaded_function">make_overloaded_function</a></code> function template can be useful to construct an overloaded function object without explicitly specifying the function types.</p>
<p>At least two distinct function types must be specified (because there is nothing to overload between one or zero functions). The maximum number of functions to overload is given by the <codeclass="computeroutput"><aclass="link"href="../BOOST_FUNCTIONAL_O_1_7_3_3.html"title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code> configuration macro. The maximum number of function parameters for each of the specified function types is given by the <codeclass="computeroutput"><aclass="link"href="../BOOST_FUNCTIONAL_O_1_7_3_2.html"title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</a></code> configuration macro.</p>
<spanclass="keyword">const</span><spanclass="identifier">boost</span><spanclass="special">::</span><spanclass="identifier">function</span><spanclass="special"><</span><spanclass="identifier">F2</span><spanclass="special">></span><spanclass="special">&</span><spanclass="special">,</span><spanclass="special">...</span><spanclass="special">)</span><spanclass="special">;</span></pre>Construct the overloaded function object. <p>Any function pointer, function reference, and monomorphic function object that can be converted to a <codeclass="computeroutput">boost::function</code> function object can be specified as parameter.</p>
<p><spanclass="bold"><strong>Note:</strong></span> Unfortunately, it is not possible to support polymorphic function objects (as explained <ahref="http://lists.boost.org/Archives/boost/2012/03/191744.php"target="_top">here</a>). </p>
<spanclass="keyword">typename</span><spanclass="identifier">boost</span><spanclass="special">::</span><spanclass="identifier">function_traits</span><spanclass="special"><</span><spanclass="identifier">F1</span><spanclass="special">></span><spanclass="special">::</span><spanclass="identifier">arg2_type</span><spanclass="special">,</span><spanclass="special">...</span><spanclass="special">)</span><spanclass="keyword">const</span><spanclass="special">;</span></pre>Call operator matching the signature of the function type specified as 1st template parameter. <p>This will in turn invoke the call operator of the 1st function passed to the constructor. </p>
<spanclass="keyword">typename</span><spanclass="identifier">boost</span><spanclass="special">::</span><spanclass="identifier">function_traits</span><spanclass="special"><</span><spanclass="identifier">F2</span><spanclass="special">></span><spanclass="special">::</span><spanclass="identifier">arg2_type</span><spanclass="special">,</span><spanclass="special">...</span><spanclass="special">)</span><spanclass="keyword">const</span><spanclass="special">;</span></pre>Call operator matching the signature of the function type specified as 2nd template parameter. <p>This will in turn invoke the call operator of the 2nd function passed to the constructor.</p>
<p><spanclass="bold"><strong>Note:</strong></span> Similar call operators are present for all specified function types <codeclass="computeroutput">F1</code>, <codeclass="computeroutput">F2</code>, etc (even if not exhaustively listed by this documentation). </p>