Boost C++ Libraries: Ticket #10864: Boost 1.57 + Xcode 6: function/lamba incompatibility
https://svn.boost.org/trac10/ticket/10864
<p>
Boost 1.57 and clang 6 (from Xcode 6) reject this program:
</p>
<pre class="wiki">#include <iostream>
#include <boost/lambda/lambda.hpp>
#include <boost/function.hpp>
typedef boost::function<void(std::ostream&)> Streamer;
void out(const Streamer& func)
{
func(std::cout);
}
int main(int argc, char *argv[])
{
out(boost::lambda::_1 << "hi there\n");
return 0;
}
</pre><p>
Errors start with:
</p>
<pre class="wiki">boost/lambda/detail/lambda_traits.hpp:256:58: error: cannot form a reference to 'void'
typename detail::IF<boost::is_function<T>::value, T&, const T>::RET
^
</pre><p>
This works with Boost 1.55 with clang 6.
</p>
<p>
This works with Boost 1.57 with older compilers.
</p>
en-us
Boost C++ Libraries
/htdocs/site/boost.png
https://svn.boost.org/trac10/ticket/10864
Trac 1.4.3
-
nat@…
Wed, 10 Dec 2014 19:03:24 GMT
<link>https://svn.boost.org/trac10/ticket/10864#comment:1 </link>
<guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10864#comment:1</guid>
<description>
<p>
The following is a viable workaround:
</p>
<pre class="wiki">#include <iostream>
#include <boost/phoenix/core/argument.hpp>
#include <boost/phoenix/operator/bitwise.hpp>
#include <boost/function.hpp>
typedef boost::function<void(std::ostream&)> Streamer;
void out(const Streamer& func)
{
func(std::cout);
}
int main(int argc, char *argv[])
{
out(boost::phoenix::placeholders::arg1 << "hi there\n");
return 0;
}
</pre>
</description>
<category>Ticket</category>
</item>
</channel>
</rss>