vendredi 2 janvier 2015

Are c++11 signals equivalent to boost.signals

As I undersand many boost libs are included in c++11 standart. After changing boost:: to std:: I have managed to compile them using c++11 compiler. I have problem to compile this code which contains 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();
}


I am getting this error:



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;


Isn't std::signal equivalent to boost::signal?


Aucun commentaire:

Enregistrer un commentaire