How to Capture Variables in a Lambda Formula

Asked 2 years ago, Updated 2 years ago, 32 views

I'd like to copy variables into the lambda expression, but is there any good way to put variables into the lambda expression in the case of classes that create or copy instances with functions?

Ta(T::create_instance());// instance creation 
Tb(T::create_instance());
b. copy(a); // a to b. copy

  // lambda system
  Auto func=[b]<-------b does not have a copy constructor and results in an error.
  { 
     // processing
  };
  intret = func();

c++

2022-09-29 22:42

1 Answers

Resolved with initialization capture that you answered in the comments section.
Thank you.


2022-09-29 22:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.