Skip to content

Commit ed366a3

Browse files
committed
tiles: player input works well
block on player and immediate modes implemented
1 parent c9f1acf commit ed366a3

4 files changed

Lines changed: 307 additions & 65 deletions

File tree

‎cpp/decltype.cpp‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010

1111
#include "common.hpp"
1212

13+
int f() {
14+
return 1;
15+
}
16+
17+
class C {
18+
public:
19+
int f() { return 2; }
20+
};
21+
1322
int main() {
1423
#if __cplusplus >= 201103L
1524
int i = 1;
@@ -32,5 +41,15 @@ int main() {
3241
std::vector<decltype(i)> v;
3342
v.push_back(0);
3443
}
44+
45+
// Return value.
46+
{
47+
decltype(f) i;
48+
assert(sizeof(i) == sizeof(int));
49+
50+
C c;
51+
decltype(c.f()) j;
52+
assert(sizeof(i) == sizeof(int));
53+
}
3554
#endif
3655
}

‎cpp/iterator.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ int main() {
9696
}
9797

9898
/*
99-
# range based for loop #foreach
99+
# range based for loop
100+
101+
# foreach
100102
101103
C++11
102104

‎cpp/unique_ptr.cpp‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,17 @@ int main() {
116116
p.reset();
117117
assert(Base::count == 0);
118118
}
119+
120+
/*
121+
# unique_ptr function argments
122+
123+
- `std::move` for transfering ownership
124+
- TODO for not transfering ownership:
125+
- `const &`
126+
- `get()`. Simple and efficient. But how to use it for containers like `vector<std::unique_ptr>`?
127+
128+
http://stackoverflow.com/questions/8114276/how-do-i-pass-a-unique-ptr-argument-to-a-constructor-or-a-functionhttp://stackoverflow.com/questions/8114276/how-do-i-pass-a-unique-ptr-argument-to-a-constructor-or-a-function
129+
*/
130+
{
131+
}
119132
}

0 commit comments

Comments
 (0)