Skip to content

Commit

Permalink
ref-qualify move assignments for improved safety
Browse files Browse the repository at this point in the history
  • Loading branch information
szhorvat committed Jul 29, 2024
1 parent 69f77dd commit c746348
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Graph {

Graph & operator = (const Graph &) = delete;

Graph & operator = (Graph &&other) noexcept {
Graph & operator = (Graph &&other) && noexcept {
if (! is_alias())
igraph_destroy(ptr);
if (other.is_alias()) {
Expand Down
2 changes: 1 addition & 1 deletion include/mat_pmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ template<> class Mat<OBASE> {
return *this;
}

Mat & operator = (Mat &&other) noexcept {
Mat & operator = (Mat &&other) && noexcept {
if (! is_alias())
FUNCTION(igraph_matrix, destroy)(ptr);
if (other.is_alias()) {
Expand Down
4 changes: 2 additions & 2 deletions include/typed_list_pmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ template<>
#endif
class LIST_TYPE_TEMPL {
template<typename ValueType, typename Reference> class base_iterator;

public:
using igraph_type = TYPE;

Expand Down Expand Up @@ -46,7 +46,7 @@ class LIST_TYPE_TEMPL {

LIST_TYPE & operator = (const LIST_TYPE &other) = delete;

LIST_TYPE & operator = (LIST_TYPE &&other) noexcept {
LIST_TYPE & operator = (LIST_TYPE &&other) && noexcept {
if (! is_alias())
FUNCTION(destroy)(ptr);
if (other.is_alias()) {
Expand Down
2 changes: 1 addition & 1 deletion include/vec_pmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ template<> class Vec<OBASE> {
return *this;
}

Vec & operator = (Vec &&other) noexcept {
Vec & operator = (Vec &&other) && noexcept {
if (! is_alias())
FUNCTION(igraph_vector, destroy)(ptr);
if (other.is_alias()) {
Expand Down

0 comments on commit c746348

Please sign in to comment.