Skip to content

Commit

Permalink
adjacency_matrix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed May 30, 2024
1 parent e35f4e7 commit 13a51c8
Showing 1 changed file with 9 additions and 27 deletions.
36 changes: 9 additions & 27 deletions src/entt/graph/adjacency_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,8 @@ class adjacency_matrix {
: matrix{vertices * vertices, allocator},
vert{vertices} {}

/**
* @brief Copy constructor.
* @param other The instance to copy from.
*/
adjacency_matrix(const adjacency_matrix &other)
: adjacency_matrix{other, other.get_allocator()} {}
/*! @brief Default copy constructor. */
adjacency_matrix(const adjacency_matrix &) = default;

/**
* @brief Allocator-extended copy constructor.
Expand All @@ -150,12 +146,8 @@ class adjacency_matrix {
: matrix{other.matrix, allocator},
vert{other.vert} {}

/**
* @brief Move constructor.
* @param other The instance to move from.
*/
adjacency_matrix(adjacency_matrix &&other) noexcept
: adjacency_matrix{std::move(other), other.get_allocator()} {}
/*! @brief Default move constructor. */
adjacency_matrix(adjacency_matrix &&) noexcept = default;

/**
* @brief Allocator-extended move constructor.
Expand All @@ -164,32 +156,22 @@ class adjacency_matrix {
*/
adjacency_matrix(adjacency_matrix &&other, const allocator_type &allocator)
: matrix{std::move(other.matrix), allocator},
vert{std::exchange(other.vert, 0u)} {}
vert{other.vert} {}

/*! @brief Default destructor. */
~adjacency_matrix() noexcept = default;

/**
* @brief Default copy assignment operator.
* @param other The instance to copy from.
* @return This adjacency matrix.
* @return This container.
*/
adjacency_matrix &operator=(const adjacency_matrix &other) {
matrix = other.matrix;
vert = other.vert;
return *this;
}
adjacency_matrix &operator=(const adjacency_matrix &) = default;

/**
* @brief Default move assignment operator.
* @param other The instance to move from.
* @return This adjacency matrix.
* @return This container.
*/
adjacency_matrix &operator=(adjacency_matrix &&other) noexcept {
matrix = std::move(other.matrix);
vert = std::exchange(other.vert, 0u);
return *this;
}
adjacency_matrix &operator=(adjacency_matrix &&other) noexcept = default;

/**
* @brief Returns the associated allocator.
Expand Down

0 comments on commit 13a51c8

Please sign in to comment.