瀏覽代碼

Handling of self move assignment.

main
offa 7 年之前
父節點
當前提交
526a869cfb
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. +7
    -4
      include/unique_resource.h

+ 7
- 4
include/unique_resource.h 查看文件

> >
unique_resource& operator=(unique_resource&& other) 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; return *this;
} }



Loading…
取消
儲存