Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strategy for dealing with members of templates with lifetimes #49

Open
seanbaxter opened this issue Sep 12, 2024 · 0 comments
Open

Strategy for dealing with members of templates with lifetimes #49

seanbaxter opened this issue Sep 12, 2024 · 0 comments

Comments

@seanbaxter
Copy link
Collaborator

Had a problem with this example. The rc_inner struct has data members with lifetimes (manually_drop data_). That lifetime refers not to the rc_inner but to the outer class rc. This needs some special normalization.

What's the strategy? Simplest is to just error. But it seems we can implicitly provide lifetime parameters on rc_inner. Which ones? Only the ones used? All the ones in the surrounding class? When does naming rc_inner give it implicit lifetime arguments?

template<class T+>
class [[unsafe::send(false)]] rc
{
  struct rc_inner;
  rc_inner* unsafe p_;

  struct rc_inner
  {
    manually_drop<T> data_;
    std::size_t strong_;
    std::size_t weak_;

    explicit
    rc_inner(T data) noexcept safe;
  };

public:

  explicit rc(T t) safe;
  rc(rc const^ rhs) safe;
  [[unsafe::drop_only(T)]] ~rc() safe;

  T const^ operator*(self const^) noexcept safe {
    return *self->p_->data_.get();
  }
};
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

No branches or pull requests

1 participant