【发布时间】:2015-11-02 17:59:12
【问题描述】:
在函数中,我需要将 std::bind 的可调用对象作为参数传递。 我应该使用什么正确的类型/模板?
void foo(std::function<void(KnownType)> function, WhatShouldThisBe target)
{
std::bind(function, target);
}
那么预期用途是:
std::shared_ptr<SomeType> bar = std::make_shared<SomeType>();
foo(&SomeType::function, bar);
【问题讨论】:
-
带有签名
void()的函数不接受参数。错别字?
标签: c++ function templates c++11 bind