Content #
Since C++11, the standard uses the term function object for every object that can be used as a function call. 下面所列均可称为function object:
- function pointers
- objects of classes with operator ()
- objects of classes with a conversion to a point to function
- lambdas
C++中的function object比起普通的函数来说,有三个优点,请问是哪三个? #
1.Function objects are “functions with state.” 2.Each function object has its own type. 3.Function objects are usually faster than ordinary functions.