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

Fix C++17 deprecation warning from std::allocator::is_always_equal #52

Closed

Conversation

edsavage
Copy link

@edsavage edsavage commented Dec 1, 2021

When compiling with support for C++17 the following deprecation warning is encountered

C:\usr\local\include\boost-1_77\boost/unordered/detail/implementation.hpp(1452,7): warning C4996: 'std::allocator<std::pair<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::basic_string<char,std::char_traits<char>,std::allocator<char>>>>::is_always_equal': warning STL4010: Various members of std::allocator are deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.

Following the lead suggested here
https://groups.google.com/g/boost-developers-archive/c/3MOWuQgEEy4/m/boIwsJsdBAAJ
and using boost::allocator_is_always_equal from
<boost/core/allocator_access.hpp> does fix the source of the deprecation warning.

Following the lead suggested here
https://groups.google.com/g/boost-developers-archive/c/3MOWuQgEEy4/m/boIwsJsdBAAJ
and using boost::allocator_is_always_equal from
<boost/core/allocator_access.hpp> does work.

However boost::allocator_is_always_equal itself requires a minor change
to add a `value` member in order to keep e.g. boost::unordered_set
happy. That is the subject of another PR that will need to be merged
ahead of this one.
@glenfe
Copy link
Member

glenfe commented Dec 1, 2021

All of the Unordered allocator traits machinery should be removed and replaced with <boost/core/allocator_access.hpp> which simplifies Unordered's implementation drastically. @LeonineKing1199 is working on this.

@glenfe
Copy link
Member

glenfe commented Dec 8, 2021

@LeonineKing1199 can you confirm that this is now fixed in develop?

@cmazakas
Copy link
Member

cmazakas commented Dec 8, 2021

@glenfe @edsavage

I can happily confirm that the deprecation warning no longer appears!

For example, consider the logs from AppVeyor here which is a slightly older build.

Compare it to the logs in the latest AppVeyor run here.

No more warnings!

If you wish to confirm yourself, I'd recommend downloading the logs themselves as the AppVeyor site seems to struggle with rendering that much output whereas downloading the logs and opening them with a minimal text editor is quite fast.

@edsavage
Copy link
Author

edsavage commented Dec 8, 2021

Closing this PR as this the issue it was trying to fix has been addressed in a better way.

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.

3 participants