Last active
February 27, 2019 03:03
-
-
Save ox1111/694946804224f8200d1eb0316fb0e7d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
// g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.69.0/gcc-8.3.0/include -std=c++17 | |
// | |
// | |
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
int main() { | |
int x = 1, y = 1; | |
std::cout << x << " " << y << std::endl; | |
auto func1 = [&x, &y]() { cout << ++x << " " << ++y << endl; }; | |
func1(); | |
auto func2 = [=]() mutable{ cout << ++x << " " << endl; }; | |
func2(); | |
auto func3 = [&]() mutable{ cout << ++x << " " << endl; }; | |
func3(); | |
auto func4 = [x, &y]()mutable { cout << ++x << " " << ++y << endl; }; | |
func4(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment