Bladeren bron

Handling of self move assignment.

main
offa 7 jaren geleden
bovenliggende
commit
526a869cfb
1 gewijzigde bestanden met toevoegingen van 7 en 4 verwijderingen
  1. +7
    -4
      include/unique_resource.h

+ 7
- 4
include/unique_resource.h Bestand weergeven

@@ -178,10 +178,13 @@ namespace sr
>
unique_resource& operator=(unique_resource&& other)
{
reset();
m_resource = std::forward<RR>(other.m_resource);
m_deleter = std::forward<DD>(other.m_deleter);
m_execute_on_destruction = std::exchange(other.m_execute_on_destruction, false);
if( this != &other )
{
reset();
m_resource = std::forward<RR>(other.m_resource);
m_deleter = std::forward<DD>(other.m_deleter);
m_execute_on_destruction = std::exchange(other.m_execute_on_destruction, false);
}
return *this;
}


Laden…
Annuleren
Opslaan