Skip to content

Commit

Permalink
src: shorten copy assignment operator decl for Point
Browse files Browse the repository at this point in the history
  • Loading branch information
zbjornson committed Oct 30, 2022
1 parent 2876b6e commit ad18c6c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Point.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
// Copyright (c) 2010 LearnBoost <tj@learnboost.com>
#pragma once

#include <algorithm>

template <typename T>
class Point {
public:
T x, y;
Point(T x=0, T y=0): x(x), y(y) {}
Point(const Point&) = default;
Point& operator=(Point other) {
std::swap(x, other.x);
std::swap(y, other.y);
return *this;
}
Point& operator=(const Point&) = default;
};

0 comments on commit ad18c6c

Please sign in to comment.