#pragma once #include "sixtyfps_sharedarray_internal.h" namespace sixtyfps { template struct SharedArray { SharedArray() { internal::sixtyfps_shared_array_new_null(reinterpret_cast *>(this)); } SharedArray(const SharedArray &other) { internal::sixtyfps_shared_array_clone( reinterpret_cast *>(this), reinterpret_cast *>(&other)); } ~SharedArray() { internal::sixtyfps_shared_array_drop(reinterpret_cast *>(this)); } SharedArray &operator=(const SharedArray &other) { internal::sixtyfps_shared_array_drop(reinterpret_cast *>(this)); internal::sixtyfps_shared_array_clone( reinterpret_cast *>(this), reinterpret_cast *>(&other)); return *this; } SharedArray &operator=(SharedArray &&other) { std::swap(inner, other.inner); return *this; } private: void *inner; // opaque }; }