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

intrusive_ptr aliasing constructor? #93

Open
schaumb opened this issue Apr 21, 2022 · 0 comments
Open

intrusive_ptr aliasing constructor? #93

schaumb opened this issue Apr 21, 2022 · 0 comments

Comments

@schaumb
Copy link

schaumb commented Apr 21, 2022

Hi all,

I want to ask that is it reliable to implement intrusive_ptr aliasing constructor, similar to shared_ptr existing one?

Possible usage:

struct Test1 : boost::intrusive_ref_counter<Test1> {
  int a;
};

struct Test2 : boost::intrusive_ref_counter<Test2> {
  int b;
};

void fun(boost::intrusive_ptr<int> ctr);

auto iptr1 = boost::intrusive_ptr<Test1>(new Test1);
auto iptr2 = boost::intrusive_ptr<Test2>(new Test2);

fun( {iptr1, &iptr1->a} );
fun( {iptr2, &iptr2->b} );
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