Skip to content

Refactor lifetime model selection into type traits - #69

Open
mingxwa wants to merge 1 commit into
ngcpp:feature/v5from
mingxwa:user/mingxwa/box-refactoring
Open

Refactor lifetime model selection into type traits#69
mingxwa wants to merge 1 commit into
ngcpp:feature/v5from
mingxwa:user/mingxwa/box-refactoring

Conversation

@mingxwa

@mingxwa mingxwa commented Aug 15, 2026

Copy link
Copy Markdown
Member

Replace the *_impl proxy creation functions with type traits that name the selected lifetime model, so that the models can be reused by types other than proxy (e.g. an upcoming box in v5). No observable behavior change.

  • Rename the internal allocated_ptr class template to wide_ptr, and add allocated_ptr, owned_ptr and shared_ptr type traits that select a lifetime model instead of constructing a proxy directly. The creation functions now construct proxy<F> from the selected pointer type.
  • Let inplace_ptr ignore its first constructor argument so that all owning lifetime models share a uniform (alloc, args...) construction signature.
  • Order the T&& value overload first in each creation function family, and renumber the corresponding specs to match.

Replace the `*_impl` proxy creation functions with type traits that name the
selected lifetime model, so that the models can be reused by types other than
`proxy` (e.g. an upcoming `box`). No observable behavior change.

- Rename the internal `allocated_ptr` class template to `wide_ptr`, and add
  `allocated_ptr`, `owned_ptr` and `shared_ptr` type traits that select a
  lifetime model instead of constructing a `proxy` directly. The creation
  functions now construct `proxy<F>` from the selected pointer type.
- Let `inplace_ptr` ignore its first constructor argument so that all owning
  lifetime models share a uniform `(alloc, args...)` construction signature.
- Order the `T&& value` overload first in each creation function family, and
  renumber the corresponding specs to match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant