[sigc] sigc++ & C++0x



Hi,

I am trying to combine sigc++ with C++0x Lambdas, but when using lambdas
returning a value, this desn't seem to work:

#include <iostream>
#include <sigc++/sigc++.h> // using 2.2.4.2 from ubuntu pkages
#include <functional>

int main()
{                              
  // everything ok:
  sigc::slot<void, int> cout_number = [](int a)
                                      {
                                        std::cout << a << '\n';
                                      };
  
  cout_number(42);
                   
  std::function<bool(int)> fun_is_42 = [](int n)-> bool
                                       {
                                         return n==42;
                                       };

  // Here's nothing ok:
  sigc::slot<bool, int> try_fun = fun_is_42;  // don't seem to work 
  //sigc::slot<bool, int> try_fun = mem_fun(fun_is_42,
&std::function<bool(int)>::operator());  // also don't seem to work
  
  std::cout<<try_fun(23)<<" "<<try_fun(42)<<"\n";
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]