Skip to content

Commit

Permalink
Replace boost::intrusive_ptr with TfIntrusiveTrackingPtr for `VtV…
Browse files Browse the repository at this point in the history
…alue`
  • Loading branch information
nvmkuruc committed Jan 3, 2024
1 parent 49d6d18 commit 69ca087
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pxr/base/vt/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "pxr/base/tf/safeTypeCompare.h"
#include "pxr/base/tf/stringUtils.h"
#include "pxr/base/tf/tf.h"
#include "pxr/base/tf/trackingPtr.h"
#include "pxr/base/tf/type.h"

#include "pxr/base/vt/api.h"
Expand All @@ -49,8 +50,6 @@
#include "pxr/base/vt/traits.h"
#include "pxr/base/vt/types.h"

#include <boost/intrusive_ptr.hpp>

#include <iosfwd>
#include <typeinfo>
#include <type_traits>
Expand Down Expand Up @@ -764,30 +763,30 @@ class VtValue

////////////////////////////////////////////////////////////////////////
// Remote-storage type info implementation. The container is an
// intrusive_ptr to an object holder: _Counted<T>.
// TfIntrusiveTrackingPtr to an object holder: _Counted<T>.
template <class T>
struct _RemoteTypeInfo : _TypeInfoImpl<
T, // type
boost::intrusive_ptr<_Counted<T> >, // container
_RemoteTypeInfo<T> // CRTP
T, // type
TfIntrusiveTrackingPtr<_Counted<T>>, // container
_RemoteTypeInfo<T> // CRTP
>
{
constexpr _RemoteTypeInfo()
: _TypeInfoImpl<
T, boost::intrusive_ptr<_Counted<T>>, _RemoteTypeInfo<T>>()
T, TfIntrusiveTrackingPtr<_Counted<T>>, _RemoteTypeInfo<T>>()
{}

typedef boost::intrusive_ptr<_Counted<T> > Ptr;
using Ptr = TfIntrusiveTrackingPtr<_Counted<T>>;
// Get returns object stored in the pointed-to _Counted<T>.
static T &_GetMutableObj(Ptr &ptr) {
if (!ptr->IsUnique())
ptr.reset(new _Counted<T>(ptr->Get()));
ptr = TfIntrusiveMakeTrackingPtr<_Counted<T>>(ptr->Get());
return ptr->GetMutable();
}
static T const &_GetObj(Ptr const &ptr) { return ptr->Get(); }
// PlaceCopy() allocates a new _Counted<T> with a copy of the object.
static void _PlaceCopy(Ptr *dst, T const &src) {
new (dst) Ptr(new _Counted<T>(src));
new (dst) Ptr(TfTrackingPtrRetainTag, new _Counted<T>(src));
}
};

Expand Down

0 comments on commit 69ca087

Please sign in to comment.