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

Use std::allocator_traits #3804

Merged
merged 1 commit into from
Jan 13, 2024
Merged

Use std::allocator_traits #3804

merged 1 commit into from
Jan 13, 2024

Conversation

phprus
Copy link
Contributor

@phprus phprus commented Jan 12, 2024

Discussion: 872635d#r136913458

And fix MSVC warning.

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I was hoping that SFINAE would be less cumbersome =). Considering how niche this feature is I think we should go back to your suggestion of using std::allocator_traits pulled in transitively and fallback on ignoring max_size on pre-C++11 systems.

@phprus
Copy link
Contributor Author

phprus commented Jan 13, 2024

@vitaut
We can include <memory> only for gcc < 5 and remove it later, after gcc < 5 is no longer supported.
What do your think about it? It will be the smallest change.

@vitaut
Copy link
Contributor

vitaut commented Jan 13, 2024

We can include only for gcc < 5 and remove it later, after gcc < 5 is no longer supported.
What do your think about it? It will be the smallest change.

Great idea, let's do it.

@phprus phprus changed the title Implement allocator_max_size Use std::allocator_traits Jan 13, 2024
include/fmt/format.h Outdated Show resolved Hide resolved
#include <stdexcept> // std::runtime_error
#include <string> // std::string
#include <system_error> // std::system_error
#if defined(__GLIBCXX__) && !defined(_GLIBCXX_USE_DUAL_ABI)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe __GLIBCXX__ < 20150422 instead of _GLIBCXX_USE_DUAL_ABI? https://stackoverflow.com/questions/37118114/value-of-glibcxx-for-each-libstdc-release

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing dates won't work:
#2349 (comment)

include/fmt/format.h Outdated Show resolved Hide resolved
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
@vitaut vitaut merged commit 21b0458 into fmtlib:master Jan 13, 2024
41 checks passed
@vitaut
Copy link
Contributor

vitaut commented Jan 13, 2024

Thank you!

happymonkey1 pushed a commit to happymonkey1/fmt that referenced this pull request Apr 7, 2024
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
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.

2 participants