От: | kov_serg | ||
Дата: | 14.05.18 20:10 | ||
Оценка: |
first-class status if it can be passed as a parameter,
_NN>#include <iostream>
_NN>#include <memory>
_NN>using namespace std;
_NN>void f(auto) {}
_NN>int main()
_NN>{
_NN> f([]{});
_NN>}
_NN>
_NN>returned from a subroutine, or assigned into a variable
_NN>#include <iostream>
_NN>#include <memory>
_NN>using namespace std;
_NN>auto f() { return []{return 1;}; } // returned from a subroutine
auto f(int f) { if (f) return [=]{return f;}; return [=]{return f-1;}; }
l=f(); l=f(); // не работает