-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2675 from guwirth/fix-2672
fix cognitive complexity problem with r-value references
- Loading branch information
Showing
4 changed files
with
93 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
struct DeleteSample { // = 0 | ||
DeleteSample(const DeleteSample&) = delete; | ||
DeleteSample& operator=(const DeleteSample&) = delete; | ||
DeleteSample(DeleteSample&&) = delete; | ||
DeleteSample& operator=(DeleteSample&&) = delete; | ||
~DeleteSample() = default; | ||
}; | ||
|
||
struct DefaultSample { // = 0 | ||
DefaultSample(const DefaultSample&) = default; | ||
DefaultSample& operator=(const DefaultSample&) = default; | ||
DefaultSample(DefaultSample&&) = default; | ||
DefaultSample& operator=(DefaultSample&&) = default; | ||
~DefaultSample() = default; | ||
}; | ||
|
||
struct Sample { // = 5 | ||
Sample(const Sample&) { | ||
if (true) { | ||
std::cout << "+1" << std::endl; | ||
} | ||
} | ||
Sample& operator=(const Sample&) { | ||
if (true) { | ||
std::cout << "+1" << std::endl; | ||
} | ||
} | ||
Sample(Sample&&) { | ||
if (true) { | ||
std::cout << "+1" << std::endl; | ||
} | ||
} | ||
Sample& operator=(Sample&&) { | ||
if (true) { | ||
std::cout << "+1" << std::endl; | ||
} | ||
} | ||
~Sample() { | ||
if (true) { | ||
std::cout << "+1" << std::endl; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
template<typename T> | ||
class host : public std::enable_shared_from_this<host<T>> { | ||
public: | ||
template<typename... U> | ||
explicit host(U&&... args); // should ignore && | ||
host() = delete; | ||
host(const host&) = delete; | ||
host(host&&) = default; // should ignore && and default | ||
host& operator=(const host&) = delete; | ||
host& operator=(host&&) = default; // should ignore && and default | ||
}; |