Got rid of intrusive_ptr

release/4.3a0
Frank Dellaert 2023-02-05 20:28:12 -08:00
parent 438e29353d
commit c13f58a67e
1 changed files with 1 additions and 10 deletions

View File

@ -19,7 +19,6 @@
#include <gtsam/base/timing.h>
#include <memory>
#include <boost/intrusive_ptr.hpp>
#include <iostream>
@ -48,14 +47,6 @@ struct VirtualCounted {
virtual ~VirtualCounted() {}
};
void intrusive_ptr_add_ref(VirtualCounted* obj) { ++ obj->refCount; }
void intrusive_ptr_release(VirtualCounted* obj) {
assert(obj->refCount > 0);
-- obj->refCount;
if(obj->refCount == 0)
delete obj;
}
int main(int argc, char *argv[]) {
size_t trials = 10000000;
@ -145,7 +136,7 @@ int main(int argc, char *argv[]) {
gttic_(intrusive_virtual_alloc_dealloc_call);
for(size_t i=0; i<trials; ++i) {
intrusive_ptr<VirtualCounted> obj(new VirtualCounted(i));
std::shared_ptr<VirtualCounted> obj(new VirtualCounted(i));
obj->setData(i+1);
}
gttoc_(intrusive_virtual_alloc_dealloc_call);