mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
Fixing some issues from rebasing
This commit is contained in:
parent
45fa4c0dc4
commit
77c555a3a8
21 changed files with 85 additions and 158 deletions
|
@ -27,6 +27,12 @@ struct NewRef
|
|||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* This has to be forward decalred and known here in order for us to be able
|
||||
* cast this in the `Unref` function.
|
||||
*/
|
||||
class OpaqueVal;
|
||||
|
||||
/**
|
||||
* An intrusive, reference counting smart pointer implementation. Much like
|
||||
* @c std::shared_ptr, this smart pointer models shared ownership of an object
|
||||
|
@ -113,7 +119,14 @@ public:
|
|||
~IntrusivePtr()
|
||||
{
|
||||
if ( ptr_ )
|
||||
Unref((zeek::Obj*)ptr_);
|
||||
{
|
||||
// Specializing `OpaqueVal` as MSVC compiler does not detect it
|
||||
// inheriting from `zeek::Obj` so we have to do that manually.
|
||||
if constexpr ( std::is_same_v<T, OpaqueVal> )
|
||||
Unref(reinterpret_cast<zeek::Obj*>(ptr_));
|
||||
else
|
||||
Unref(ptr_);
|
||||
}
|
||||
}
|
||||
|
||||
void swap(IntrusivePtr& other) noexcept { std::swap(ptr_, other.ptr_); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue