latest SDK

This commit is contained in:
2021-12-14 00:28:25 -07:00
commit 68b10d413b
492 changed files with 80542 additions and 0 deletions

38
pfc/autoref.h Normal file
View File

@@ -0,0 +1,38 @@
#pragma once
#include <memory>
namespace pfc {
// autoref<> : turn arbitrary ptr that needs to be delete'd into a shared_ptr<> alike
template<typename obj_t> class autoref {
public:
autoref() {}
autoref(std::nullptr_t) {}
autoref(obj_t * source) {
attach(source);
}
void attach(obj_t * source) {
PFC_ASSERT( source != nullptr );
m_obj = std::make_shared<holder_t>(source);
}
void reset() {
m_obj.reset();
}
obj_t * operator->() const {
return m_obj->get_ptr();
}
obj_t * get() const {
if (! m_obj ) return nullptr;
return m_obj->get_ptr();
}
operator bool() const {
return !!m_obj;
}
private:
typedef pfc::ptrholder_t< obj_t > holder_t;
std::shared_ptr< holder_t > m_obj;
};
}