why function objects should be pass-by-value
问题 I have just read the classic book "Effective C++, 3rd Edition", and in item 20 the author concludes that built-in types, STL iterators and function object types are more appropriate for pass-by-value . I could well understand the reason for built-in and iterators types, but why should the function object be pass-by-value , as we know it is class-type anyway? 回答1: In a typical case, a function object will have little or (more often) no persistent state. In such a case, passing by value may no