fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <functional>
  4.  
  5. using namespace std;
  6.  
  7. struct a {
  8. inline static std::function<int(const int )> my_lambda;
  9.  
  10. } sa;
  11.  
  12. // geht gar nicht
  13. // a::my_lambda = [](const int in) { return 4 * in; } ;
  14.  
  15.  
  16. int main() {
  17.  
  18. // geht so lala
  19. a::my_lambda = [](const int in) { return 4 * in; } ;
  20.  
  21. int lambda_out = a::my_lambda(3);
  22.  
  23. cout << lambda_out << endl;
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 4312KB
stdin
Standard input is empty
stdout
12