boost :: bind()是按引用还是按值复制参数?
|
为什么valgrind \的DRD工具抱怨\“大小为4的线程冲突加载...”:关于这样的代码:
void SomeFunction(const int& value)
{
boost::bind(..., value); /* <-- complaines on this line
with last backtrace function \"new(int)\" */
}
boost :: bind()是否按引用或值存储值?
没有找到相关结果
已邀请:
1 个回复
臀博
1 http://www.boost.org/doc/libs/1_46_1/libs/bind/bind.html#Purpose i值的副本存储在函数对象中。 boost :: ref和boost :: cref可用于使函数对象存储对对象的引用,而不是副本: 整数i = 5; bind(f,ref(i),_1); bind(f,cref(42),_1);