std::bind a bound function

后端 未结 2 1320
情话喂你
情话喂你 2020-11-27 06:48

I\'m having trouble in detecting why the heck is this not compiling. I\'ve got some lambda function that returns a std::function based on some argument.

<
2条回答
  •  日久生厌
    2020-11-27 07:30

    some_fun wants argument of type const std::function &.

    std::bind returns "a function object of unspecified type T" (look at provided link, section "Return value"), that you are trying to pass as some_fun argument.

    It seems this causes problem, because this argument type is not expected.

    Look at: http://en.cppreference.com/w/cpp/utility/functional/bind

提交回复
热议问题