Selaa lähdekoodia

Handling of self move assignment.

main
offa 7 vuotta sitten
vanhempi
commit
526a869cfb
1 muutettua tiedostoa jossa 7 lisäystä ja 4 poistoa
  1. +7
    -4
      include/unique_resource.h

+ 7
- 4
include/unique_resource.h Näytä tiedosto

@@ -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;
}


Loading…
Peruuta
Tallenna