Alternative to std::function for passing function as argument (callbacks, etc.)

前端 未结 3 1913
面向向阳花
面向向阳花 2020-12-29 06:14

I stumbled across this during my experiments with C++11. I find that it is an obvious solution, but I haven\'t been able to find any other examples of it in the wild, so I\'

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 07:04

    "Alternative to std::function for passing function as argument"

    One alternative would be a function pointer (including member function pointer). But std::function is just so much nicer (IMO).

提交回复
热议问题