Pārlūkot izejas kodu

Handling of self move assignment.

main
offa pirms 7 gadiem
vecāks
revīzija
526a869cfb
1 mainītis faili ar 7 papildinājumiem un 4 dzēšanām
  1. +7
    -4
      include/unique_resource.h

+ 7
- 4
include/unique_resource.h Parādīt failu

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


Notiek ielāde…
Atcelt
Saglabāt