This patch adds a bunch of pointer-related stuff. In summary:
best::box<T>, best::box<T[]>, and best::vbox<T> are nicer std::unique_ptr replacements.
best::ptr<T> got a facelift: the copying/moving functions have been updated to be the canonical generic memcpy entrypoitns.
best::vptr<T> and best::vtable are necessary to implement virtual pointers that use the best::malloc allocator. Unlike C++ virtual pointers, they carry sufficient information for making it possible to (fallibly) copy a best::vbox<T> and to stride a best::vptr<T>. Although NYI, this makes best::vbox<T[]> a posibility.
bytes.h is gone: its functionality now lives in best::ptr and best::span.
best::span<T> now lives under best/memory.
best::vec<T> and best::box<T[]> are inter-convertible.
best::malloc now uses allocator cookies in debug mode to ensure sized delete is used correctly.
Although not tested yet, all of the above has custom allocator support. I need to implement best::arena or similar and add tests for best::box<T, best::arena&> and friends.
This patch adds a bunch of pointer-related stuff. In summary:
best::box<T>
,best::box<T[]>
, andbest::vbox<T>
are nicerstd::unique_ptr
replacements.best::ptr<T>
got a facelift: the copying/moving functions have been updated to be the canonical generic memcpy entrypoitns.best::vptr<T>
andbest::vtable
are necessary to implement virtual pointers that use thebest::malloc
allocator. Unlike C++ virtual pointers, they carry sufficient information for making it possible to (fallibly) copy abest::vbox<T>
and to stride abest::vptr<T>
. Although NYI, this makesbest::vbox<T[]>
a posibility.bytes.h
is gone: its functionality now lives inbest::ptr
andbest::span
.best::span<T>
now lives underbest/memory
.best::vec<T>
andbest::box<T[]>
are inter-convertible.best::malloc
now uses allocator cookies in debug mode to ensure sized delete is used correctly.Although not tested yet, all of the above has custom allocator support. I need to implement
best::arena
or similar and add tests forbest::box<T, best::arena&>
and friends.