Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- int main()
- {
- auto a = []() { return new char; };
- char* b = a();
- std::printf("%p\n", b); // -> "0x..."
- auto c = [b]() { std::printf("%p\n", b); };
- c(); // -> "0x..."
- auto d = [&b]() { delete b; b = NULL; };
- d();
- std::printf("%p\n", b); // -> "(nil)"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement