Skip to content

Commit cb38438

Browse files
committed
feat: remove Coordinate2D::clone
1 parent dd4e1f6 commit cb38438

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

include/mcpp/util.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,6 @@ struct Coordinate2D {
180180
*/
181181
Coordinate2D operator-(const Coordinate2D& obj) const;
182182

183-
/**
184-
* @brief Creates a copy of the Coordinate2D object.
185-
*
186-
* @return A new Coordinate2D object that is a copy of the current object.
187-
*/
188-
[[nodiscard]] Coordinate2D clone() const;
189-
190183
/**
191184
* @brief Outputs the Coordinate2D object to an ostream.
192185
*

src/util.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ Coordinate2D Coordinate2D::operator-(const Coordinate2D& obj) const {
7474
return result;
7575
}
7676

77-
Coordinate2D Coordinate2D::clone() const {
78-
return Coordinate2D(this->x, this->z);
79-
}
80-
8177
std::string to_string(const Coordinate2D& coord) {
8278
using std::to_string;
8379
return "(" + to_string(coord.x) + "," + to_string(coord.z) + ")";
@@ -175,7 +171,7 @@ HeightMap& HeightMap::operator=(const HeightMap& other) noexcept {
175171
delete[] raw_heights;
176172

177173
// Copy data from the other object
178-
_base_pt = other._base_pt.clone();
174+
_base_pt = other._base_pt;
179175
_x_len = other._x_len;
180176
_z_len = other._z_len;
181177

@@ -211,6 +207,6 @@ int HeightMap::x_len() const { return this->_x_len; }
211207

212208
int HeightMap::z_len() const { return this->_z_len; }
213209

214-
Coordinate2D HeightMap::base_pt() const { return this->_base_pt.clone(); }
210+
Coordinate2D HeightMap::base_pt() const { return this->_base_pt; }
215211

216212
} // namespace mcpp

0 commit comments

Comments
 (0)