Skip to content

Instantly share code, notes, and snippets.

@ox1111
Last active February 27, 2019 03:03
Show Gist options
  • Save ox1111/694946804224f8200d1eb0316fb0e7d7 to your computer and use it in GitHub Desktop.
Save ox1111/694946804224f8200d1eb0316fb0e7d7 to your computer and use it in GitHub Desktop.
//
//
// 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