mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Merge pull request #211 from tkruse/fix-mdstyle11
fix bad mix of tabs and spaces
This commit is contained in:
commit
48c3c3b549
|
@ -11762,9 +11762,8 @@ If you define a destructor, you should not use the compiler-generated copy or mo
|
|||
// ...
|
||||
public:
|
||||
|
||||
~X() { /* custom stuff, such as closing hnd */ }
|
||||
|
||||
// suspicious: no mention of copying or moving -- what happens to hnd?
|
||||
~X() { /* custom stuff, such as closing hnd */ }
|
||||
// suspicious: no mention of copying or moving -- what happens to hnd?
|
||||
};
|
||||
|
||||
X x1;
|
||||
|
@ -11777,18 +11776,18 @@ If you define copying, and any base or member has a type that defines a move ope
|
|||
string s; // defines more efficient move operations
|
||||
// ... other data members ...
|
||||
public:
|
||||
x(const x&) { /* stuff */ }
|
||||
x& operator=(const x&) { /* stuff */ }
|
||||
x(const x&) { /* stuff */ }
|
||||
x& operator=(const x&) { /* stuff */ }
|
||||
|
||||
// BAD: failed to also define a move construction and move assignment
|
||||
// (why wasn't the custom "stuff" repeated here?)
|
||||
};
|
||||
// BAD: failed to also define a move construction and move assignment
|
||||
// (why wasn't the custom "stuff" repeated here?)
|
||||
};
|
||||
|
||||
x test()
|
||||
{
|
||||
x local;
|
||||
// ...
|
||||
return local; // pitfall: will be inefficient and/or do the wrong thing
|
||||
// ...
|
||||
return local; // pitfall: will be inefficient and/or do the wrong thing
|
||||
}
|
||||
|
||||
If you define any of the copy constructor, copy assignment operator, or destructor, you probably should define the others.
|
||||
|
|
Loading…
Reference in New Issue
Block a user