gcc 4.7.2에서 일부 코드를 C++ 11로 변환하려고합니다. 코드의 일부에는 boost::factory
이 boost::function
에 할당되어 있습니다. 그러나 std::function
으로 변경하면 많은 경고와 함께 컴파일이 실패합니다. S
가 인수를 취하지 않는 경우,boost :: factory and std :: function
#include <boost/functional/factory.hpp>
#include <boost/function.hpp>
#include <functional>
struct S {
S(int) {}
};
int main() {
boost::function<S*(int)> b = boost::factory<S*>(); // ok
std::function<S*(int)> s = boost::factory<S*>(); // error
}
이 std::function<S*()>
은 불평없이 boost::factory
에 할당, 흥미롭게도 error: no match for call to ‘(boost::factory<S*>) (int)’
제공 : 다음 샘플 코드에게 재현 한 오류입니다. 왜이 기능이 작동하지 않습니까? boost::factory
을 std::function
에 할당 할 수있는 방법이 있습니까? 내가 Boost.1.53