-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
54 lines (40 loc) · 712 Bytes
/
Main.cpp
File metadata and controls
54 lines (40 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <string>
#include <stdlib.h>
#define LOG(msg) std::cout << msg <<std::endl
class Entity
{
private:
std::string m_Name;
// DEBUG ONLY!!!
mutable int m_DebugCount = 0;
public:
const std::string& GetName() const
{
m_DebugCount++;
return m_Name;
}
};
int main()
{
const Entity e;
e.GetName();
int x = 8;
// using no variables
// auto f = []()
// using every variable by reference
// auto f = [&]()
// using every variable by value
// auto f = [=]()
// mutable lambda (throw-away-function) -> every variable parsed by value is copied -> can be changed
auto f = [=]() mutable
{
x++;
LOG("Hello World!");
LOG(x);
};
std::cin.get();
}
/*
*
*/