You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so it would not be available for compiled_string-based format strings. Thus the version from core.h will be chosen.
By adding a new formatted_size() implementation specifically for compiled_string-based format strings. This also requires marking a conversion operator in compiled_string-based format strings explicit, which results in changing few lines in compile.h for conversion (with using "custom" FMT_STRING_IMPL macro).
There is no difference between these 2 ways in performance because of compilers optimizations. But there is a difference between runtime API and compile-time API (lack of support for named spec'ed fields, for example). So which way should we choose to fix broken formatted_size()?
Maybe it's not even a problem because, maybe, a format string from compile-time API shouldn't be used in formatted_size().
The text was updated successfully, but these errors were encountered:
I think we should go with the second option except that instead of making the conversion operator explicit the formatted_size overload should be templatized like other formatting functions.
There is a problem using
formatted_size()
with format strings for compile-time API -FMT_COMPILE
and_cf
. Here Is an example - https://godbolt.org/z/zz3c1E, and a simplified version of it - https://godbolt.org/z/drW1rG.This problem can be solved in at least two ways:
fmt/include/fmt/compile.h
Lines 837 to 840 in ab0f7d7
compiled_string
-based format strings. Thus the version fromcore.h
will be chosen.formatted_size()
implementation specifically forcompiled_string
-based format strings. This also requires marking a conversion operator incompiled_string
-based format strings explicit, which results in changing few lines incompile.h
for conversion (with using "custom"FMT_STRING_IMPL
macro).There is no difference between these 2 ways in performance because of compilers optimizations. But there is a difference between runtime API and compile-time API (lack of support for named spec'ed fields, for example). So which way should we choose to fix broken
formatted_size()
?Maybe it's not even a problem because, maybe, a format string from compile-time API shouldn't be used in
formatted_size()
.The text was updated successfully, but these errors were encountered: