fork(3) download
  1. #include <tr1/memory>
  2. #include <functional>
  3. #include <tr1/functional>
  4.  
  5. struct Foo {
  6. void test(std::tr1::shared_ptr<int> i) {}
  7. };
  8.  
  9. int main() {
  10. Foo f;
  11. std::function<void(std::tr1::shared_ptr<int>)> func = std::bind(&Foo::test, f, std::placeholders::_1);
  12.  
  13. return 0;
  14. }
  15.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:11:68: error: conversion from 'std::_Bind_helper<false, void (Foo::*)(std::tr1::shared_ptr<int>), Foo&, const std::_Placeholder<1>&>::type {aka std::_Bind<std::_Mem_fn<void (Foo::*)(std::tr1::shared_ptr<int>)>(Foo, std::_Placeholder<1>)>}' to non-scalar type 'std::function<void(std::tr1::shared_ptr<int>)>' requested
     std::function<void(std::tr1::shared_ptr<int>)> func = std::bind(&Foo::test, f, std::placeholders::_1);
                                                                    ^
stdout
Standard output is empty