使用的static_cast用的boost ::绑定 [英] using static_cast with boost::bind

查看:225
本文介绍了使用的static_cast用的boost ::绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想类型T的矢量变换到vectorof类型K.
我想这一点,但它不工作:

<$p$p><$c$c>transform(vec.rbegin(),vec.rend(),vecNew.begin(),boost::bind(static_cast<K>(),_1));

我得到的错误:预期的主要-EX前pression')'标记。我在做什么错了?


解决方案

使用升压投仿 ll_static_cast&LT; K&GT;()

I want to transform a vector of type T to a vectorof type K. I tried this, but it doesn't work:

transform(vec.rbegin(),vec.rend(),vecNew.begin(),boost::bind(static_cast<K>(),_1));

I get the error: "expected primary-expression before ‘)’ token". What am I doing wrong?

解决方案

Use the boost cast functor ll_static_cast<K>()

这篇关于使用的static_cast用的boost ::绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆