Skip to content

Commit

Permalink
🎨 Check for self-assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
Drewniok committed Apr 4, 2024
1 parent db6b748 commit 056df91
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions include/mockturtle/views/names_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ class names_view : public Ntk

names_view<Ntk>& operator=( names_view<Ntk> const& named_ntk )
{
Ntk::operator=( named_ntk );
_signal_names = named_ntk.get_signal_names();
_network_name = named_ntk._network_name;
_output_names = named_ntk.get_output_names();

if ( this != &named_ntk ) // Check for self-assignment
{
Ntk::operator=( named_ntk );
_signal_names = named_ntk.get_signal_names();
_network_name = named_ntk._network_name;
_output_names = named_ntk.get_output_names();
}
return *this;
}

Expand Down

0 comments on commit 056df91

Please sign in to comment.