c++ - 将 static_cast 与 boost::bind 结合使用

标签 c++ boost bind

我想将类型 T 的 vector 转换为类型 K 的 vector 。 我试过这个,但它不起作用:

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

我收到错误:“在‘)’标记之前需要主表达式”。我做错了什么?

最佳答案

使用 boost cast 仿函数 ll_static_cast<K>()

关于c++ - 将 static_cast 与 boost::bind 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3430152/

相关文章:

c++ - 如何创建使用重写函数的非成员函数?

c++ - 在结构中初始化空 vector - C++

c++ - 我可以在 C++ 中使用 boost 生成多少个线程?

wpf - 动态改变 FocusManager.FocusedElement

haskell - 将单子(monad)绑定(bind)到复合 Material 中(Haskell)

c++ - 如何将 Winpcap 包含到 Qt creator?

c++ - 使用 std::transform 将字符串转换为所有大写字母

c++ - 如何使用 C++ 将 Boost ptree 插入 MongoDB

python - 在遵循 boost python 的逐步指导时引发了 boost python 错误

c++ - 使用 Variadic 模板的困难