Skip to content

Releases: cschreib/observable_unique_ptr

v0.3.0

07 Nov 13:55
d5c9493
Compare
Choose a tag to compare

Main changes:

  • observable_unique_ptr will now optimize memory usage for empty (stateless) deleters for all versions of C++, not just C++20.
  • observable_unique_ptr has been split into observable_unique_ptr and observable_sealed_ptr. The former preserves the original API, except that allocation optimisation in make_observable_unique() has been disabled (it prevents writing a safe release() function). The latter has the same API except it is missing void reset(T*) and T* release(); once a raw pointer is acquired, it is "sealed" inside the smart pointer. This enables the allocation optimisation in make_observable_sealed(). You can choose between the two pointers depending on your needs:
    • need to be able to release()? use observable_unique_ptr.
    • do not need to be able to release()? use observable_sealed_ptr (reset(T*) can be replaced by assignment).
  • Added tests and official support for WebAssembly / Emscripten.

Small changes and bug fixes:

  • Fixed observer_ptr not assignable from observable_unique_ptr with a custom deleter, and not assignable from other observer pointer of same type.
  • Fixed release() not flagging the observable_unique_ptr as expired for observers.
  • Fixed control block allocated and not freed when constructing observable_unique_ptr with a T* equal to nullptr (but not directly nullptr).
  • Fixed release() from a make_observable_unique() pointer leaving observer pointer with a dangling control block when the user deletes the released pointer.
  • Added speed benchmarks.

v0.2.0

06 Nov 19:06
Compare
Choose a tag to compare

Main changes / breaking changes:

  • weak_ptr is renamed to observer_ptr and no longer has a lock() function; you can just de-reference it like a normal pointer, and will get nullptr if the object has been deleted.
  • The implementation no longer uses std::shared_ptr under the hood, so most of the limitations (e.g., type-erased deleter, no release()) have been lifted.

Small changes and bug fixes:

  • fixed operator== not compiling for observable_unique_ptr
  • fixed observer_ptr not constructible from derived type
  • added memory leak tests
  • added missing comparison operators for observer_ptr
  • added missing operator bool()

v0.1.0

06 Nov 19:04
Compare
Choose a tag to compare

Initial release.