mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-05 14:11:43 +00:00
fix(clang-tidy): performance fixes applied in tests and CI (#3051)
* Initial fixes * Whoops * Finish clang-tidy manual fixes * Add two missing fixes * Revert * Update clang-tidy * Try to fix unreachable code error * Move nolint comment * Apply missing fix * Don't override clang-tidy config * Does this fix clang-tidy? * Make all clang-tidy errors visible * Add comments about NOLINTs and remove a few * Fix typo
This commit is contained in:
@@ -16,9 +16,18 @@ class Vector2 {
|
||||
public:
|
||||
Vector2(float x, float y) : x(x), y(y) { print_created(this, toString()); }
|
||||
Vector2(const Vector2 &v) : x(v.x), y(v.y) { print_copy_created(this); }
|
||||
Vector2(Vector2 &&v) : x(v.x), y(v.y) { print_move_created(this); v.x = v.y = 0; }
|
||||
Vector2(Vector2 &&v) noexcept : x(v.x), y(v.y) {
|
||||
print_move_created(this);
|
||||
v.x = v.y = 0;
|
||||
}
|
||||
Vector2 &operator=(const Vector2 &v) { x = v.x; y = v.y; print_copy_assigned(this); return *this; }
|
||||
Vector2 &operator=(Vector2 &&v) { x = v.x; y = v.y; v.x = v.y = 0; print_move_assigned(this); return *this; }
|
||||
Vector2 &operator=(Vector2 &&v) noexcept {
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
v.x = v.y = 0;
|
||||
print_move_assigned(this);
|
||||
return *this;
|
||||
}
|
||||
~Vector2() { print_destroyed(this); }
|
||||
|
||||
std::string toString() const { return "[" + std::to_string(x) + ", " + std::to_string(y) + "]"; }
|
||||
|
||||
Reference in New Issue
Block a user