3 ms·
>nested functions They are not supported. In C++11 you can use lambdas: auto const local_func = [&](...) { ... }; And then later: local_func(...);
by Kristine1975 11y ago
>nested functions
They are not supported. In C++11 you can use lambdas:
auto const local_func = [&](...) {
...
};
And then later:
local_func(...);
- CyberDildonics 11y agoNot only that but you can even create a struct inside a function and overload operator(). I don't know if this is possible in C++03 or not.
- Kristine1975 11y ago>I don't know if this is possible in C++03 or not. It is/was. It could be used to manually create a lambda function.
- lultimouomo 11y agoBut note that you cannot use such class as a template parameter, as it has no linkage. Which makes it mostly useless, since you usually want to use lambdas with templates. This restriction has been lifted in C++11.
- CyberDildonics 11y agoInside of a function too?
- kkylin 11y agoCool, thanks!