Explorar el Código

Handling of self move assignment.

main
offa hace 7 años
padre
commit
526a869cfb
Se han modificado 1 ficheros con 7 adiciones y 4 borrados
  1. +7
    -4
      include/unique_resource.h

+ 7
- 4
include/unique_resource.h Ver fichero

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


Cargando…
Cancelar
Guardar