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

Support compile-time format string checking with std::format #2544

Merged
merged 9 commits into from
Nov 12, 2022

Conversation

sylveon
Copy link
Contributor

@sylveon sylveon commented Nov 11, 2022

Now std::format and fmtlib are equivalent when using spdlog with either.

include/spdlog/details/fmt_helper.h Outdated Show resolved Hide resolved
include/spdlog/logger.h Outdated Show resolved Hide resolved
include/spdlog/logger.h Outdated Show resolved Hide resolved

#ifndef SPDLOG_USE_STD_FORMAT
template<typename T, typename... Args>
inline fmt::basic_string_view<T> to_string_view(fmt::basic_format_string<T, Args...> fmt)
Copy link
Owner

Choose a reason for hiding this comment

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

shouldn’t this be SPDLOG_CONSTEXPR_FUNC as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No because the conversion operator for fmt::basic_format_string to fmt::basic_string_view is not constexpr

@gabime gabime merged commit 4f80077 into gabime:v1.x Nov 12, 2022
@gabime
Copy link
Owner

gabime commented Nov 12, 2022

Merged.Thanks @sylveon

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.

None yet

2 participants