Get the App
SLTechnology News&Howtos  ›  Development  › 

How to compare STL function object with function pointer

Shulou Source: shulou.com Published: 2022-06-03 05:55:33 11月18日 Update

How to compare STL function objects and function pointers? in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Definition and use of function objects and function pointers

The two are defined in different ways and used in the same way.

# include using namespace std;//function objectclass obj_Add {public: int operator () (int val1, int val2) {return val1 + val2;}}; / function pointerint fun_Add (int val1, int val2) {return val1 + val2;} int main (int argc, char * argv []) {/ / function object obj_Add obj_add; cout

Tags: Functions objects pointers questions ways methods more help answers different no easy same easy content blogs guys buddies that is members Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Microsoft Huawei Redmi Apple