Skip to content

Conversation

cschreib
Copy link
Owner

@cschreib cschreib commented Nov 7, 2021

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.
    • no need to be able to release()? use observable_sealed_ptr (reset(T*) can be achieved by assignment).
  • Added tests and official support for WebAssembly / Emscripten.

Additional changes:

  • Fixed observer_ptr not assignable from observable_unique_ptr with a custom deleter, and not assignable from other observer pointer of same type.
  • 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.
@cschreib cschreib merged commit d5c9493 into main Nov 7, 2021
@cschreib cschreib deleted the wasm branch November 7, 2021 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant