File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
1322int 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}
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments