Boost C++ Libraries: Ticket #9631: function_input_iterator does not work with lambda https://svn.boost.org/trac10/ticket/9631 <p> The following program does not compile on g++-4.8.1/clang-3.4 </p> <blockquote> <p> 1 #define BOOST_RESULT_OF_USE_DECLTYPE 2 #include &lt;boost/iterator/function_input_iterator.hpp&gt; 3 4 int main() { 5 auto f = [](){return 1;}; 6 auto i = boost::make_function_input_iterator(f, 0); 7 return 0; 8 } </p> </blockquote> <p> error: g++ main.cpp -std=c++0x -I/home/wygos/libs/boost_1_55_0/include/ </p> <blockquote> <p> In file included from main.cpp:2:0: /home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp: In instantiation of ‘class boost::impl::function_input_iterator&lt;main()::<span class="underline">lambda0, int&gt;’: /home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp:112:11: required from ‘class boost::function_input_iterator&lt;main()::</span>lambda0, int&gt;’ </p> </blockquote> <p> main.cpp:6:54: required from here </p> <blockquote> <p> /home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp:26:15: error: no type named ‘result_type’ in ‘struct main()::<span class="underline">lambda0’ </span></p> <blockquote> <p> class function_input_iterator </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> /home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp:48:17: error: no type named ‘result_type’ in ‘struct main()::<span class="underline">lambda0’ </span></p> <blockquote> <blockquote> <blockquote> <p> dereference() const { <sup> </sup></p> </blockquote> </blockquote> </blockquote> <p> /home/wygos/libs/boost_1_55_0/include/boost/iterator/function_input_iterator.hpp:59:62: error: no type named ‘result_type’ in ‘struct main()::<span class="underline">lambda0’ </span></p> <blockquote> <blockquote> <p> mutable optional&lt;typename Function::result_type&gt; value; </p> </blockquote> </blockquote> </blockquote> <p> Suggested solution: </p> <blockquote> <p> function_input_iterator should use boost::result_of </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9631 Trac 1.4.3 Piotr Wygocki <wygos@…> Wed, 05 Feb 2014 11:09:13 GMT <link>https://svn.boost.org/trac10/ticket/9631#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9631#comment:1</guid> <description> <p> The code was suppressed to one line. I paste it one more time. </p> <p> #define BOOST_RESULT_OF_USE_DECLTYPE </p> <p> #include &lt;boost/iterator/function_input_iterator.hpp&gt; </p> <p> int main() { </p> <p> auto f = [](){return 1;}; </p> <p> auto i = boost::make_function_input_iterator(f, 0); </p> <p> return 0; </p> <p> } </p> </description> <category>Ticket</category> </item> <item> <author>Piotr Wygocki <wygos@…></author> <pubDate>Wed, 05 Feb 2014 11:22:27 GMT</pubDate> <title>version changed https://svn.boost.org/trac10/ticket/9631#comment:2 https://svn.boost.org/trac10/ticket/9631#comment:2 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.54.0</span> → <span class="trac-field-new">Boost 1.55.0</span> </li> </ul> Ticket viboes Wed, 26 Feb 2014 21:29:01 GMT component changed; owner set https://svn.boost.org/trac10/ticket/9631#comment:3 https://svn.boost.org/trac10/ticket/9631#comment:3 <ul> <li><strong>owner</strong> set to <span class="trac-author">jeffrey.hellrung</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">iterator</span> </li> </ul> Ticket