adding functor example
This commit is contained in:
@@ -17,11 +17,13 @@ but powerful.
|
||||
```cpp
|
||||
class my_class_name {
|
||||
public:
|
||||
// ... normal class stuff ...
|
||||
my_return_type operator() ( /* my list of args */ );
|
||||
// ... normal class stuff ...
|
||||
my_return_type operator() ( /* my list of args */ );
|
||||
};
|
||||
```
|
||||
|
||||
- See and run this simple functor [example](functor.cpp).
|
||||
|
||||
## 21.2 Why are Functors Useful?
|
||||
|
||||
- One example is the default 3rd argument for std::sort. We know that by default STL’s sort routines will use
|
||||
|
||||
Reference in New Issue
Block a user