mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
IntrusivePtr: optimize release() using std::exchange()
This commit is contained in:
parent
3bc33fe7f6
commit
6f3e9d2c4c
1 changed files with 1 additions and 4 deletions
|
@ -123,10 +123,7 @@ public:
|
|||
*/
|
||||
pointer release() noexcept
|
||||
{
|
||||
auto result = ptr_;
|
||||
if ( result )
|
||||
ptr_ = nullptr;
|
||||
return result;
|
||||
return std::exchange(ptr_, nullptr);
|
||||
}
|
||||
|
||||
IntrusivePtr& operator=(IntrusivePtr other) noexcept
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue