많은 boost 라이브러리가 C++ 11 standart에 포함되어 있습니다. boost::
을 std::
으로 변경 한 후 C++ 11 컴파일러를 사용하여 컴파일했습니다. boost::signals
이 들어있는이 코드를 컴파일하는 데 문제가 있습니다.C++ 11 신호는 boost.signals와 같습니다.
#include <iostream>
#include <functional>
#include <csignal>
void func()
{
std::cout << "Hello world" << std::endl;
}
int main()
{
std::signal<void()> s;
s.connect(func);
s();
}
나는이 오류가 무엇입니까
:
prog.cpp: In function ‘int main()’:
prog.cpp:12:19: error: invalid operands of types ‘void (*(int, __sighandler_t)throw())(int) {aka void (*(int, void (*)(int))throw())(int)}’ and ‘void’ to binary ‘operator<’
std::signal<void()> s;
^
prog.cpp:12:22: error: ‘s’ was not declared in this scope
std::signal<void()> s;
가 boost::signal
에 해당 std::signal
되지 않습니다?
이것은 [cargo cult] (http://en.wikipedia.org/wiki/Cargo_cult_programming)를 많이 상기시켜줍니다. 시스템이 헤더 파일을 암호화합니까? 또는 [cppreference] (http://en.cppreference.com/w/cpp/utility/program/signal)를 차단 하시겠습니까? – sehe
'boost :: signals'은 C++ 11에 포함되어 있고 다른 boost 라이브러리와의 유사성 때문에'std :: signal'이라는 이름을 가져야한다고 생각했습니다. – Ashot