Liste des Groupes | Revenir à cl c |
On 03/05/2024 09:58, Bonita Montero wrote:Practically there isn't a difference.Am 03.05.2024 um 09:38 schrieb David Brown:A C-style function /pointer/ is an object. A C-style /function/ is not. Do you understand the difference?
>No it is not. C-style functions (or C++ functions for that matter) are not objects, and do not have calling operators. Built-in operators do not belong to a type, in the way that class operators do.>
You can assign a C-style function pointer to an auto function-object.
That these function objects all have the same type doesn't metter.
>You missed the point entirely. Lambdas can be used in many ways like functions, and it is possible for one function (or lambda) to return a different function, and can be used for higher-order functions (functions that have functions as parameters or return types). They do not mean that C++ can treat functions as first-class objects, but they /do/ mean that you can get many of the effects you might want if C++ functions really were first-class objects.>
C-style functions and lambda-types are generically interchangeable.
>
Les messages affichés proviennent d'usenet.