How does the template parameter of std::function work? (implementation)

后端 未结 5 1218
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 08:45

In Bjarne Stroustrup\'s home page (C++11 FAQ):

struct X { int foo(int); };

std::function f;
f = &X::foo; //pointer to membe         


        
5条回答
  •  离开以前
    2020-12-07 09:31

    They're not function pointers. That's what std::function exists for. It wraps whatever callable types you give it. You should check out boost::bind- it's often used to make member function pointers callable as (this, args).

提交回复
热议问题