Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using X = int;
- X x;
- std::function<void(void)> foo;
- {
- X& ref = x;
- foo = [&ref](){ ref = 123; };
- }
- foo();
- using X = int;
- std::unique_ptr<X> x = std::make_unique<X>(0);
- std::function<void(void)> foo;
- {
- X& ref = *x;
- foo = [&ref](){ ref = 123; };
- }
- foo();
Advertisement
Add Comment
Please, Sign In to add comment