好像用functor的地方都可以用function来替换.但看到一本书有这样写:C++ provides a better and more elegant solution: function objects or functors.
不知functor比function到底elegant在哪里呢???他们两个有什么差别呢???
...全文
967打赏收藏
请教一个问题:关于function 与 functor的理解
我自己理解这两个除了形式上的差别好像没有其它的差别了 好像用functor的地方都可以用function来替换.但看到一本书有这样写:C++ provides a better and more elegant solution: function objects or functors. 不知functor比function到底elegant在哪里呢???他们两个有什么差别呢???