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

observer_ptr<T> #70

Open
bernhardmgruber opened this issue Oct 5, 2019 · 10 comments
Open

observer_ptr<T> #70

bernhardmgruber opened this issue Oct 5, 2019 · 10 comments

Comments

@bernhardmgruber
Copy link

There was much disagreement on the future of std::observer_ptr<T> during the WG21 Cologne meeting this summer (objection against moving it into the standard, but no consensus for dropping it from the library fundamentals TS3). So maybe Boost is the right place for this handy little utility.

What are your thoughts? Would you accept a PR adding observer_ptr<T> to Boost.SmartPtr?

@pdimov
Copy link
Member

pdimov commented Oct 6, 2019

Possibly, but I'm not convinced that observer_ptr is the right name. :-)

@glenfe
Copy link
Member

glenfe commented Oct 6, 2019

@bernhardmgruber You can propose observer_ptr as a new Boost library too. fixed_string is going this route instead of going into Boost.Container. The same for span.

@bernhardmgruber
Copy link
Author

@pdimov The name has been bikesheded to death by WG21 during the years and observer_ptr<T> was the best they got. I don't want to reopen the discussion, because I feel less qualified to pick a better name ;)
@glenfe Would you prefer having observer_ptr<T> in its own library? I thought that going the way through an existing library might be easier than sending an entire new one through the review process.

@glenfe
Copy link
Member

glenfe commented Oct 6, 2019

Users have that preference now-a-days, to be able to pull in small independent components without dependencies on other Boost libraries.

The other advantage is that the facility will receive a Boost review. It had a WG21 review, but (speaking as a WG21 and C++ Standard committee member) a Boost review is worth it.

@pdimov
Copy link
Member

pdimov commented Oct 6, 2019

I don't see much to review there. Except the name. That part of the review will be fun. :-)

@pdimov
Copy link
Member

pdimov commented Oct 6, 2019

POLLS 

Drop observer_ptr from the TS. 

SF  F  N  A  SA  
7  9  7  7  4  

Move observer_ptr to Annex D of the standard (deprecated). 

SF  F  N  A  SA  
5  6  5  13  6  

Move observer_ptr toward the WD, no special policy. 

SF  F  N  A  SA  
2  4  4  14  12  

Move observer_ptr toward the WD, with LEWG policy to ignore it in the standard. 

SF  F  N  A  SA  
4  8  9  5  9  

Not very encouraging.

@glenfe
Copy link
Member

glenfe commented Oct 6, 2019

Should be an easy review then. :)

@pdimov
Copy link
Member

pdimov commented Oct 6, 2019

Actually no, I take that back. There are some parts of the design that I'd change. The pointer constructor should be implicit; there shouldn't be a conversion to a raw pointer; and, arguably, shared_ptr should be implicitly convertible to observer_ptr.

@bernhardmgruber
Copy link
Author

My colleague @MFHava and me finally found some time to put together a simple implementation with some documentation. Most of it is taken quite directly from the working draft. I talked to Walter E. Brown during the last WG21 meeting in Cologne and he was fine with letting us try to publish his work as a boost library.

The repository is here: https://github.com/MFHava/observer_ptr

How would you recommend to proceed now? I guess there will be a lot to polish before we can start an actual boost review, whatever that means.

@glenfe
Copy link
Member

glenfe commented Nov 1, 2019

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

3 participants