`boost::phoenix::static_cast_` 与标准库混合使用

发布于 2024-12-11 11:42:32 字数 5704 浏览 0 评论 0 原文

这是 Phoenix v3 的一个错误。它与 Phoenix v2 编译得很好。 我做了错误报告。 我将在 2 天内将此问题标记为已解决。谢谢大家。

我正在尝试用phoenix制作一个简短的lamba,但是我收到了一堆编译错误。这是代码。

std::vector<unsigned char> data;
using boost::phoenix::arg_names::_1;
using boost::phoenix::static_cast_;
std::ostringstream oss;
oss << std::hex;
//Doesn't compile
std::for_each(data.begin(),data.end(), oss <<  static_cast_<unsigned int>(_1) );
//Compiles
std::for_each(data.begin(),data.end(), oss << _1 );

现在我从 GCC 4.6.1 收到以下编译错误: /usr/include/boost/utility/result_of.hpp:-1: 在 'boost::detail::result_of_nested_result>, 0l>&, boost::phoenix::actor ; >, 0l>>, boost::phoenix::vector2>, 0l> >, boost::phoenix::actor >、0l>、boost::phoenix::actor >, 0l> > >, 2l> > >, 2l> >*, unsigned char&>&, const boost::phoenix::default_actions&>)>':

/usr/include/boost/phoenix/object/static_cast.hpp: 29:错误:“结构”的声明boost::phoenix::static_cast_eval::结果 >, 0l>&, boost::phoenix::actor>, 0l>>&, boost::phoenix::vector2>, 0l> >, boost::phoenix::actor >、0l>、boost::phoenix::actor >, 0l> > >, 2l> > >, 2l> >*,无符号字符&>&,const boost::phoenix::default_actions>)>'

/usr/include/boost/phoenix/core/detail/preprocessed/call_10 .hpp:65:错误:“struct”中没有名为“type”的类型boost::result_of>, 0l>&, boost::phoenix::actor ; >, 0l>>, boost::phoenix::vector2>, 0l> >, boost::phoenix::actor >、0l>、boost::phoenix::actor >, 0l> > >, 2l> > >, 2l> >*,无符号字符&>&,const boost::phoenix::default_actions&>)>'

It is a Phoenix v3 bug. It compiles with Phoenix v2 just fine.
I did bug report.
I will mark this question as resolved in 2 days. Thank you all.

I am trying to make a short lamba with phoenix, but I get bunch of compile errors. Here is the code.

std::vector<unsigned char> data;
using boost::phoenix::arg_names::_1;
using boost::phoenix::static_cast_;
std::ostringstream oss;
oss << std::hex;
//Doesn't compile
std::for_each(data.begin(),data.end(), oss <<  static_cast_<unsigned int>(_1) );
//Compiles
std::for_each(data.begin(),data.end(), oss << _1 );

Now I get the following compile error from GCC 4.6.1:
/usr/include/boost/utility/result_of.hpp:-1: In instantiation of ‘boost::detail::result_of_nested_result<boost::phoenix::static_cast_eval, boost::phoenix::static_cast_eval(boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>&, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >&, boost::phoenix::vector2<boost::phoenix::vector2<const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostringstream<char>&>, 0l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::static_cast_, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> > >, 2l> > >, 2l> >*, unsigned char&>&, const boost::phoenix::default_actions&>)>’:

/usr/include/boost/phoenix/object/static_cast.hpp:29: error: declaration of ‘struct boost::phoenix::static_cast_eval::result<boost::phoenix::static_cast_eval(boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>&, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >&, boost::phoenix::vector2<boost::phoenix::vector2<const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostringstream<char>&>, 0l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::static_cast_, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> > >, 2l> > >, 2l> >*, unsigned char&>&, const boost::phoenix::default_actions&>)>’

/usr/include/boost/phoenix/core/detail/preprocessed/call_10.hpp:65: error: no type named ‘type’ in ‘struct boost::result_of<boost::phoenix::static_cast_eval(boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>&, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >&, boost::phoenix::vector2<boost::phoenix::vector2<const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostringstream<char>&>, 0l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::static_cast_, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> > >, 2l> > >, 2l> >*, unsigned char&>&, const boost::phoenix::default_actions&>)>’

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二手情话 2024-12-18 11:42:32

两者都在 GCC 和 GCC 上编译。 MSVC,如果我想尝试一下,我猜罪犯是:

using boost::phoenix::arg_names::_1;

还有其他具有相同名称的占位符,其中一些导入到全局范围(我相信 boost::bind 使用的一个是在全局范围内) )。最后一个错误特别暗示了这一点,因为元函数所需的类型似乎没有在某处使用。

Both compiles here on both GCC & MSVC, if I would have a stab at it I would guess that the offender is:

using boost::phoenix::arg_names::_1;

There's other placeholders with the very same name, some imported to the global scope ( I believe the one boost::bind uses is in the global scope for example ). The last error in particular hints at this, as it would seem a type that is required to be a meta function isn't is used somewhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文