Boost C++ Libraries: Ticket #7633: Wanted: a way to force a nested result_type https://svn.boost.org/trac10/ticket/7633 <p> For example, I had to use this: </p> <div class="wiki-code"><div class="code"><pre><span class="k">template</span> <span class="o">&lt;</span><span class="k">class</span> <span class="nc">F</span><span class="o">&gt;</span> <span class="k">struct</span> <span class="nl">void_function</span> <span class="p">:</span> <span class="n">F</span> <span class="p">{</span> <span class="k">typedef</span> <span class="kt">void</span> <span class="n">result_type</span><span class="p">;</span> <span class="n">void_function</span><span class="p">(</span><span class="n">F</span> <span class="n">x</span><span class="p">)</span> <span class="o">:</span> <span class="n">F</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="p">{}</span> <span class="p">};</span> <span class="k">template</span> <span class="o">&lt;</span><span class="k">class</span> <span class="nc">F</span><span class="o">&gt;</span> <span class="n">void_function</span><span class="o">&lt;</span><span class="n">F</span><span class="o">&gt;</span> <span class="n">make_void</span><span class="p">(</span><span class="n">F</span> <span class="n">x</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">void_function</span><span class="o">&lt;</span><span class="n">F</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span><span class="p">);</span> <span class="p">}</span> </pre></div></div><p> in order to get the following to work: </p> <div class="wiki-code"><div class="code"><pre><span class="kr">inline</span> <span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span> <span class="k">operator</span><span class="o">&lt;&lt;</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span> <span class="n">s</span><span class="p">,</span> <span class="n">my_variant</span> <span class="k">const</span><span class="o">&amp;</span> <span class="n">x</span><span class="p">)</span> <span class="p">{</span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">phoenix</span><span class="o">::</span><span class="n">placeholders</span><span class="p">;</span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">phoenix</span><span class="p">;</span> <span class="n">boost</span><span class="o">::</span><span class="n">apply_visitor</span><span class="p">(</span> <span class="n">make_void</span><span class="p">(</span><span class="n">s</span> <span class="o">&lt;&lt;</span> <span class="n">arg1</span><span class="p">),</span> <span class="n">x</span> <span class="p">);</span> <span class="c1">// ^^^^^^^^^ HERE</span> <span class="k">return</span> <span class="n">s</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><p> Some libraries, like Boost.Variant, don't follow the <code>result_of</code> protocol. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7633 Trac 1.4.3