Skip to content

Commit

Permalink
Fix mutant_relation::operator=.
Browse files Browse the repository at this point in the history
Defining

  template <bool FM>
  mutant_relation& operator=(const mutant_relation<TA, TB, Info, FM>& rel) {
    base_::change_to(rel);
    return *this;
  }

does not prevent the compiler from implicitly providing

  mutant_relation& operator=(const mutant_relation&);

and hence the implicit version takes over when FM == force_mutable and
does not call base_::change_to.

Replace the template version with two non-template overloads, both
calling base_::change_to.

Signed-off-by: Ignacy Gawędzki <[email protected]>
  • Loading branch information
iazz committed Aug 7, 2024
1 parent 6865e94 commit f8f13c7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/boost/bimap/relation/mutant_relation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,14 @@ class mutant_relation : public

// Operators

template< bool FM >
mutant_relation& operator=(const mutant_relation<TA,TB,Info,FM> & rel)
mutant_relation& operator=(const mutant_relation & rel)
{
base_::change_to(rel);
return *this;
}

mutant_relation& operator=(const mutant_relation<TA,TB,Info,
!force_mutable> & rel)
{
base_::change_to(rel);
return *this;
Expand Down

0 comments on commit f8f13c7

Please sign in to comment.