mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-10 21:20:07 +00:00
Merge branch 'master' of github.com:cppformat/cppformat
This commit is contained in:
commit
8c8826f749
@ -11,7 +11,7 @@ C++ Format
|
||||
:target: http://cppformat.readthedocs.org/en/stable/
|
||||
:alt: Documentation Status
|
||||
|
||||
.. image:: https://webapi.biicode.com/v1/badges/vitaut/vitaut/cppformat/master
|
||||
.. image:: https://webapi.biicode.com/v1/badges/vitaut/vitaut/cppformat/master?dummy
|
||||
:target: https://www.biicode.com/vitaut/cppformat
|
||||
|
||||
C++ Format is an open-source formatting library for C++.
|
||||
@ -288,7 +288,7 @@ tinyformat 2.0.1 tfm::printf 2.25
|
||||
Boost Format 1.54 boost::format 9.94
|
||||
================= ============= ===========
|
||||
|
||||
As you can see boost::format is much slower than the alternative methods; this
|
||||
As you can see ``boost::format`` is much slower than the alternative methods; this
|
||||
is confirmed by `other tests <http://accu.org/index.php/journals/1539>`_.
|
||||
Tinyformat is quite good coming close to IOStreams. Unfortunately tinyformat
|
||||
cannot be faster than the IOStreams because it uses them internally.
|
||||
|
14
format.cc
14
format.cc
@ -100,6 +100,12 @@ inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
|
||||
# define FMT_SNPRINTF fmt_snprintf
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
|
||||
# define FMT_SWPRINTF snwprintf
|
||||
#else
|
||||
# define FMT_SWPRINTF swprintf
|
||||
#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
|
||||
|
||||
// Checks if a value fits in int - used to avoid warnings about comparing
|
||||
// signed and unsigned integers.
|
||||
template <bool IsSigned>
|
||||
@ -388,12 +394,12 @@ int fmt::internal::CharTraits<wchar_t>::format_float(
|
||||
unsigned width, int precision, T value) {
|
||||
if (width == 0) {
|
||||
return precision < 0 ?
|
||||
swprintf(buffer, size, format, value) :
|
||||
swprintf(buffer, size, format, precision, value);
|
||||
FMT_SWPRINTF(buffer, size, format, value) :
|
||||
FMT_SWPRINTF(buffer, size, format, precision, value);
|
||||
}
|
||||
return precision < 0 ?
|
||||
swprintf(buffer, size, format, width, value) :
|
||||
swprintf(buffer, size, format, width, precision, value);
|
||||
FMT_SWPRINTF(buffer, size, format, width, value) :
|
||||
FMT_SWPRINTF(buffer, size, format, width, precision, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user