C++/CLI, how do I get a copy of the controlled class to the lambda founk?



  • He's been drinking a controlled launcher for the lambda.

    Helped here. https://ru.stackoverflow.com/questions/473127/c-cli-%D0%B4%D0%B5%D0%BB%D0%B5%D0%B3%D0%B0%D1%82%D1%8B-%D0%BB%D1%8F%D0%BC%D0%B1%D0%B4%D0%B0-action/473129?noredirect=1#comment532825_473129

    Now he's facing a new problem. I can't transfer parameters to it because the logic of use implies Action (sighs)function<void()>) I can't do this.

    auto o = gcnew MyObject();
    auto lr = gcnew RefLambdaRunner([o]()
    {
    

    });

    Compiler's fighting, like you can't hand over a controlled object to the lambdu. Help me solve this problem.



  • It's possible to use it. https://msdn.microsoft.com/ru-ru/library/481fa11f.aspx ♪ But I wouldn't recommend doing this because it's a very simple way to not follow any reference, to cyclical dependence, and to welcome the memory leak.


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2