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
Conditionally provide interfaces based on deprecated/removed std::aut… #8
Conditionally provide interfaces based on deprecated/removed std::aut… #8
Conversation
I considered merging that but I don't like the introduction of |
So, my question is:
My idea was to give users both all technically possible interfaces (i.e. stay as compatible as possible) and an opt-out-of-auto_ptr option, too. |
The opt-out-of-auto_ptr option is totally unnecessary. If BOOST_NO_CXX11_SMART_PTR is defined, leave the code as is, else use std::unique_ptr in place of std::auto_ptr. That is all you have to do. |
Second bullet, @DanielaE. What you have, just with |
979a101
to
ac21428
Compare
There it is, changes applied as advised. |
No problem, we're all volunteers here. :-) |
test/associative_test_data.hpp
Outdated
std::auto_ptr<T> ap( new T ); | ||
c.insert( ap ); | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're providing the unique_ptr
overloads when BOOST_NO_CXX11_SMART_PTR
is not defined, we should probably test them under the same condition, instead of only when BOOST_NO_AUTO_PTR
is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but that doesn't work out in all cases: in return values you only have either/or exclusively. Have a peek at line 139:
#ifndef BOOST_NO_AUTO_PTR
std::auto_ptr<C> ap2 = c.release();
#else
std::unique_ptr<C> up2 = c.release();
#endif
Sigh - this testing stuff will become tedious then...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. Perhaps just do it for the cases where it can be done easily, and leave the tedious ones as is?
Are there any other libraries for which |
You should not be testing be testing BOOST_NO_AUTO_PTR. You should only be testing BOOST_NO_CXX11_SMART_PTR. When BOOST_NO_CXX11_SMART_PTR is not defined, use unique_ptr, otherwise use auto_ptr. It really is that simple. If both BOOST_NO_AUTO_PTR and BOOST_NO_CXX11_SMART_PTR is defined you have a broken compiler, and nothing will work so you just do not waste your time with such a possibility. Please explain why you think you have to test BOOST_NO_AUTO_PTR ? |
If we just remove the |
My bad. I did not look to see that auto_ptr is part of the public/protected interface. In that case it should be changed to unique_ptr only if BOOST_NO_AUTO_PTR is defined. My apologies. I had changed a number of libraries from auto_ptr to unique_ptr, but none of them used auto_ptr except for private or detail functionality. |
I should have said, for the public/protected interfaces, change auto_ptr to unique_ptr only if BOOST_NO_AUTO_PTR is defined and BOOST_NO_CXX11_SMART_PTR is not defined, else drop the auto_ptr interface entirely; although I can not imagine any compiler for which neither auto_ptr nor unique_ptr is supported for a given C++ standard compiler level. |
Yes, there are. I have a list of open PRs which I submitted months ago. I will re-check it when I am back from work. Update: I have open PRs regarding std::auto_ptr with asio, assign, and statechart. |
…o_ptr and/or std::unique_ptr, and replace C++98 function adapters by inline typedefs. Signed-off-by: Daniela Engert <dani@ngrt.de>
ac21428
to
b805b3c
Compare
@pdimov |
This looks good to me. I'm seeing one odd error on msvc-14.1/cxxstd-17:
This doesn't look like our problem, but it might be possible to work around it (or it could be my config.) |
Fixed it, needed to change |
I do not object since I messed up originally in not understanding that the PR dealt with non-private interfaces. The code looks good and I am sorry I was such an annoyance. |
boostorg/asio#51 seems no longer relevant. |
Nobody has write access to Statechart. :-) |
Assign's Travis fails, will need to figure out why. |
Great, Boost.ASIO got some love by Chris 👍 |
…o_ptr and/or std::unique_ptr, and replace C++98 function adapters by inline typedefs.
Signed-off-by: Daniela Engert dani@ngrt.de