@@ -858,6 +858,9 @@ int main() {
858858 - the most vexing parse only happens for default constructors.
859859 - the default constructor can be is implicitly declared and defiend by the compiler.
860860
861+ There are other functions which are also defined by default:
862+ https://en.wikipedia.org/wiki/Special_member_functions
863+
861864 # Implicily declared constructors
862865
863866 If no explicit constructor is declared,
@@ -1203,32 +1206,31 @@ int main() {
12031206 }
12041207
12051208#if __cplusplus >= 201103L
1206-
12071209 /*
1208- # brace enclosed initializer list
1210+ # Brace enclosed initializer list
12091211
12101212 See inializer list
12111213
1212- # list initialization
1214+ # List initialization
12131215
12141216 See initializer list constructor.
12151217
1216- # initializer list contructor
1218+ # Initializer list contructor
12171219
12181220 Useful in cases where you don't know beforehand how many arguments
12191221 a constructor should receive.
12201222
12211223 For example, the stdlib std::vector class gets an initializer list constructor on C++11,
12221224 which allows one to initialize it to any constant.
12231225
1224- TODO0 could this not be achieved via cstdarg?
1226+ TODO could this not be achieved via cstdarg?
12251227 */
12261228 {
12271229 // STL std::vector usage example
12281230 {
12291231 std::vector<int > v{0 , 1 };
1232+ // SAME.
12301233 // std::vector<int> v = std::vector<int>({0, 1});
1231- // SAME
12321234 assert (v[0 ] == 0 );
12331235 assert (v[1 ] == 1 );
12341236 assert (v == std::vector<int >({0 , 1 }));
@@ -1681,55 +1683,6 @@ int main() {
16811683 // CopyAndSwap c2(c0);
16821684 }
16831685
1684- #if __cplusplus >= 201103L
1685- /*
1686- # xvalue
1687-
1688- # glvalue
1689-
1690- # prvalue
1691-
1692- In addition to the C99 rvalues and lvalues,
1693- the C++11 standard defines new concepts:
1694-
1695- - xvalue
1696- - glvalue
1697- - prvalue
1698-
1699- <http://stackoverflow.com/questions/3601602/what-are-rvalues-lvalues-xvalues-glvalues-and-prvalues>
1700-
1701- This is probably a consequence of move semantincs.
1702-
1703- */
1704-
1705- /*
1706- # move constructor
1707-
1708- Constructor that takes rvalues instead of lvalues.
1709-
1710- Used to implement move semantics.
1711-
1712- # move semantics
1713-
1714- Useful in situtations where a class manages dynamic data.
1715-
1716- Basic idea: when copying from an rvalue, it is not necessary to make an expensive copy of it:
1717- it suffices to acquire its data via swap, and leave it on a valid state (via a default constructor for example).
1718-
1719- This is true because the rvalue passed to a copy constructor cannot be seen.
1720-
1721- Value reference allows to overload the copy constructor based not on type,
1722- but on the fact that a value is an rvalue or an lvalue!
1723-
1724- No change must be done to the copy and swap idiom for move semantics to work for the assigment operator,
1725- since in C++11 `int i = rvale` calls a move consttuctor on `i` while `int i = lvalue` calls a copy constructor.
1726-
1727- <http://stackoverflow.com/questions/3106110/what-is-move-semantics>
1728- */
1729- {
1730- }
1731- #endif
1732-
17331686 /*
17341687 # as-if rule
17351688
0 commit comments