+ 1
Functor (function object) in C++
Hello, can someone please explain what the definition of a functor in c++ is and how it is used?
4 Respuestas
+ 5
A function is a block of code which only runs when it is called.
You can pass data, known as parameters, into a function.
Functions are used to perform certain actions, and they are important for reusing code: Define the code once, and use it many times
0
gabi rete They were asking what a functor is. You explained what a function is. For an explanation on what a functor is, please see: https://www.geeksforgeeks.org/functors-in-cpp/amp/
0
Thank you for the replies! The geeksforgeeks article is something I have read but it still does not provide the needed help. What I am trying to do is apply an STL algorythm with objects and for that a functor would be of great help if only I could get the gist of it...
0
In basic terms a functor is an object whose class has the application operator ( () ) overloaded.
It is an object that is basically used to pass a function to as an argument to another function.