mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 20:54:41 +03:00
C.64 Minor fix to make example compile (#1939)
This commit is contained in:
@@ -6165,11 +6165,11 @@ After `y = std::move(x)` the value of `y` should be the value `x` had and `x` sh
|
|||||||
|
|
||||||
##### Example
|
##### Example
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class X { // OK: value semantics
|
class X { // OK: value semantics
|
||||||
public:
|
public:
|
||||||
X();
|
X();
|
||||||
X(X&& a) noexcept; // move X
|
X(X&& a) noexcept; // move X
|
||||||
|
X& operator=(X&& a) noexcept; // move-assign X
|
||||||
void modify(); // change the value of X
|
void modify(); // change the value of X
|
||||||
// ...
|
// ...
|
||||||
~X() { delete[] p; }
|
~X() { delete[] p; }
|
||||||
@@ -6178,8 +6178,7 @@ After `y = std::move(x)` the value of `y` should be the value `x` had and `x` sh
|
|||||||
int sz;
|
int sz;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
X::X(X&& a) noexcept
|
||||||
X::X(X&& a)
|
|
||||||
:p{a.p}, sz{a.sz} // steal representation
|
:p{a.p}, sz{a.sz} // steal representation
|
||||||
{
|
{
|
||||||
a.p = nullptr; // set to "empty"
|
a.p = nullptr; // set to "empty"
|
||||||
|
|||||||
Reference in New Issue
Block a user