Boost C++ Libraries: Ticket #4962: Return type deduction issue in boost::lambda https://svn.boost.org/trac10/ticket/4962 <p> The following code stopped compiling after migration from version 1.42 to 1.45 of the library: </p> <pre class="wiki">#include &lt;algorithm&gt; #include &lt;map&gt; #include &lt;string&gt; #include &lt;iostream&gt; #include &lt;boost/lambda/lambda.hpp&gt; #include &lt;boost/lambda/bind.hpp&gt; typedef std::map&lt;int, int&gt; MyMap; std::ostream&amp; operator &lt;&lt; (std::ostream&amp; outs, const MyMap&amp; a) { std::for_each(a.begin(), a.end(), outs &lt;&lt; boost::lambda::bind(&amp;MyMap::value_type::second, boost::lambda::_1) &lt;&lt; "\n"); return outs; } int main() { MyMap a; std::cout &lt;&lt; a; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4962 Trac 1.4.3 pavel.pervov@… Wed, 08 Dec 2010 08:20:32 GMT <link>https://svn.boost.org/trac10/ticket/4962#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4962#comment:1</guid> <description> <p> The workaround for this may be explicit specialisation of boost::lambda::bind with the desired return type: </p> <pre class="wiki"> outs &lt;&lt; boost::lambda::bind&lt;int&gt;(&amp;MyMap::value_type::second, boost::lambda::_1) &lt;&lt; "\n"); </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Thu, 09 Dec 2010 04:47:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4962#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4962#comment:2</guid> <description> <p> Compiling with TOT clang, I get (after trimming a long traceback): </p> <pre class="wiki">In file included from junk.cpp:6: In file included from /Marshall/Sources/boost/release/boost/lambda/lambda.hpp:14: In file included from /Marshall/Sources/boost/release/boost/lambda/core.hpp:48: /Marshall/Sources/boost/release/boost/lambda/detail/function_adaptors.hpp:264:12: error: binding of reference to type 'int' to a value of type 'int const' drops qualifiers return o.*data; ^~~~~~~ </pre><p> and the workaround suggested by Pavel doesn't seem to help with clang++, btw. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Thu, 09 Dec 2010 17:12:05 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/4962#comment:3 https://svn.boost.org/trac10/ticket/4962#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">No-Maintainer</span> to <span class="trac-author">Steven Watanabe</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> I'm fairly certain that this was caused by result_of support. </p> Ticket Steven Watanabe Mon, 03 Jan 2011 22:31:27 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4962#comment:4 https://svn.boost.org/trac10/ticket/4962#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/67640" title="Fix return type deduction for pointers to data members. Fixes #4962. ...">[67640]</a>) Fix return type deduction for pointers to data members. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4962" title="#4962: Bugs: Return type deduction issue in boost::lambda (closed: fixed)">#4962</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4566" title="#4566: Bugs: Binding to a class member with lambda::bind() can cause const ... (closed: fixed)">#4566</a>. </p> Ticket