4.1.1 - TBD ------------ 4.1.0 - 2017-12-20 ------------------ * Added ``fmt::to_wstring()`` in addition to ``fmt::to_string()`` (`#559 `_). Thanks `@alabuzhev (Alex Alabuzhev) `_. * Added support for C++17 ``std::string_view`` (`#571 `_ and `#578 `_). Thanks `@thelostt (Mário Feroldi) `_ and `@mwinterb `_. * Enabled stream exceptions to catch errors (`#581 `_). Thanks `@crusader-mike `_. * Allowed formatting of class hierarchies with ``fmt::format_arg()`` (`#547 `_). Thanks `@rollbear (Björn Fahller) `_. * Removed limitations on character types (`#563 `_). Thanks `@Yelnats321 (Elnar Dakeshov) `_. * Conditionally enabled use of ``std::allocator_traits`` (`#583 `_). Thanks `@mwinterb `_. * Added support for ``const`` variadic member function emulation with ``FMT_VARIADIC_CONST`` (`#591 `_). Thanks `@ludekvodicka (Ludek Vodicka) `_. * Various bugfixes: bad overflow check, unsupported implicit type conversion when determining formatting function, test segfaults (`#551 `_), ill-formed macros (`#542 `_) and ambiguous overloads (`#580 `_). Thanks `@xylosper (Byoung-young Lee) `_. * Prevented warnings on MSVC (`#605 `_, `#602 `_, and `#545 `_), clang (`#582 `_), GCC (`#573 `_), various conversion warnings (`#609 `_, `#567 `_, `#553 `_ and `#553 `_), and added ``override`` and ``[[noreturn]]`` (`#549 `_ and `#555 `_). Thanks `@alabuzhev (Alex Alabuzhev) `_, `@virgiliofornazin (Virgilio Alexandre Fornazin) `_, `@alexanderbock (Alexander Bock) `_, `@yumetodo `_, `@VaderY (Császár Mátyás) `_, `@jpcima (JP Cimalando) `_, `@thelostt (Mário Feroldi) `_, and `@Manu343726 (Manu Sánchez) `_. * Improved CMake: Used GNUInstallDirs to set installation location (`#610 `_) and fixed warnings (`#536 `_ and `#556 `_). Thanks `@mikecrowe (Mike Crowe) `_, `@evgen231 `_ and `@henryiii (Henry Schreiner) `_. 4.0.0 - 2017-06-27 ------------------ * Removed old compatibility headers ``cppformat/*.h`` and CMake options (`#527 `_). Thanks `@maddinat0r (Alex Martin) `_. * Added ``string.h`` containing ``fmt::to_string()`` as alternative to ``std::to_string()`` as well as other string writer functionality (`#326 `_ and `#441 `_): .. code:: c++ #include "fmt/string.h" std::string answer = fmt::to_string(42); Thanks to `@glebov-andrey (Andrey Glebov) `_. * Moved ``fmt::printf()`` to new ``printf.h`` header and allowed ``%s`` as generic specifier (`#453 `_), made ``%.f`` more conformant to regular ``printf()`` (`#490 `_), added custom writer support (`#476 `_) and implemented missing custom argument formatting (`#339 `_ and `#340 `_): .. code:: c++ #include "fmt/printf.h" // %s format specifier can be used with any argument type. fmt::printf("%s", 42); Thanks `@mojoBrendan `_, `@manylegged (Arthur Danskin) `_ and `@spacemoose (Glen Stark) `_. See also `#360 `_, `#335 `_ and `#331 `_. * Added ``container.h`` containing a ``BasicContainerWriter`` to write to containers like ``std::vector`` (`#450 `_). Thanks `@polyvertex (Jean-Charles Lefebvre) `_. * Added ``fmt::join()`` function that takes a range and formats its elements separated by a given string (`#466 `_): .. code:: c++ #include "fmt/format.h" std::vector v = {1.2, 3.4, 5.6}; // Prints "(+01.20, +03.40, +05.60)". fmt::print("({:+06.2f})", fmt::join(v.begin(), v.end(), ", ")); Thanks `@olivier80 `_. * Added support for custom formatting specifications to simplify customization of built-in formatting (`#444 `_). Thanks `@polyvertex (Jean-Charles Lefebvre) `_. See also `#439 `_. * Added ``fmt::format_system_error()`` for error code formatting (`#323 `_ and `#526 `_). Thanks `@maddinat0r (Alex Martin) `_. * Added thread-safe ``fmt::localtime()`` and ``fmt::gmtime()`` as replacement for the standard version to ``time.h`` (`#396 `_). Thanks `@codicodi `_. * Internal improvements to ``NamedArg`` and ``ArgLists`` (`#389 `_ and `#390 `_). Thanks `@chronoxor `_. * Fixed crash due to bug in ``FormatBuf`` (`#493 `_). Thanks `@effzeh `_. See also `#480 `_ and `#491 `_. * Fixed handling of wide strings in ``fmt::StringWriter``. * Improved compiler error messages (`#357 `_). * Fixed various warnings and issues with various compilers (`#494 `_, `#499 `_, `#483 `_, `#519 `_, `#485 `_, `#482 `_, `#475 `_, `#473 `_ and `#414 `_). Thanks `@chronoxor `_, `@zhaohuaxishi `_, `@pkestene (Pierre Kestener) `_, `@dschmidt (Dominik Schmidt) `_ and `@0x414c (Alexey Gorishny) `_ . * Improved CMake: targets are now namespaced (`#511 `_ and `#513 `_), supported header-only ``printf.h`` (`#354 `_), fixed issue with minimal supported library subset (`#418 `_, `#419 `_ and `#420 `_). Thanks `@bjoernthiel (Bjoern Thiel) `_, `@niosHD (Mario Werner) `_, `@LogicalKnight (Sean LK) `_ and `@alabuzhev (Alex Alabuzhev) `_. * Improved documentation. Thanks to `@pwm1234 (Phil) `_ for `#393 `_. 3.0.2 - 2017-06-14 ------------------ * Added ``FMT_VERSION`` macro (`#411 `_). * Used ``FMT_NULL`` instead of literal ``0`` (`#409 `_). Thanks `@alabuzhev (Alex Alabuzhev) `_. * Added extern templates for ``format_float`` (`#413 `_). * Fixed implicit conversion issue (`#507 `_). * Fixed signbit detection (`#423 `_). * Fixed naming collision (`#425 `_). * Fixed missing intrinsic for C++/CLI (`#457 `_). Thanks `@calumr (Calum Robinson) `_ * Fixed Android detection (`#458 `_). Thanks `@Gachapen (Magnus Bjerke Vik) `_. * Use lean ``windows.h`` if not in header-only mode (`#503 `_). Thanks `@Quentin01 (Quentin Buathier) `_. * Fixed issue with CMake exporting C++11 flag (`#445 `_). Thanks `@EricWF (Eric) `_. * Fixed issue with nvcc and MSVC compiler bug and MinGW (`#505 `_). * Fixed DLL issues (`#469 `_ and `#502 `_). Thanks `@richardeakin (Richard Eakin) `_ and `@AndreasSchoenle (Andreas Schönle) `_. * Fixed test compilation under FreeBSD (`#433 `_). * Fixed various warnings (`#403 `_, `#410 `_ and `#510 `_). Thanks `@Lecetem `_, `@chenhayat (Chen Hayat) `_ and `@trozen `_. * Removed redundant include (`#479 `_). * Fixed documentation issues. 3.0.1 - 2016-11-01 ------------------ * Fixed handling of thousands seperator (`#353 `_) * Fixed handling of ``unsigned char`` strings (`#373 `_) * Corrected buffer growth when formatting time (`#367 `_) * Removed warnings under MSVC and clang (`#318 `_, `#250 `_, also merged `#385 `_ and `#361 `_). Thanks `@jcelerier (Jean-Michaël Celerier) `_ and `@nmoehrle (Nils Moehrle) `_. * Fixed compilation issues under Android (`#327 `_, `#345 `_ and `#381 `_), FreeBSD (`#358 `_), Cygwin (`#388 `_), MinGW (`#355 `_) as well as other issues (`#350 `_, `#366 `_, `#348 `_, `#402 `_, `#405 `_). Thanks to `@dpantele (Dmitry) `_, `@hghwng (Hugh Wang) `_, `@arvedarved (Tilman Keskinöz) `_, `@LogicalKnight (Sean) `_ and `@JanHellwig (Jan Hellwig) `_. * Fixed some documentation issues and extended specification (`#320 `_, `#333 `_, `#347 `_, `#362 `_). Thanks to `@smellman (Taro Matsuzawa aka. btm) `_. 3.0.0 - 2016-05-07 ------------------ * The project has been renamed from C++ Format (cppformat) to fmt for consistency with the used namespace and macro prefix (`#307 `_). Library headers are now located in the ``fmt`` directory: .. code:: c++ #include "fmt/format.h" Including ``format.h`` from the ``cppformat`` directory is deprecated but works via a proxy header which will be removed in the next major version. The documentation is now available at http://fmtlib.net. * Added support for `strftime `_-like `date and time formatting `_ (`#283 `_): .. code:: c++ #include "fmt/time.h" std::time_t t = std::time(nullptr); // Prints "The date is 2016-04-29." (with the current date) fmt::print("The date is {:%Y-%m-%d}.", *std::localtime(&t)); * ``std::ostream`` support including formatting of user-defined types that provide overloaded ``operator<<`` has been moved to ``fmt/ostream.h``: .. code:: c++ #include "fmt/ostream.h" class Date { int year_, month_, day_; public: Date(int year, int month, int day) : year_(year), month_(month), day_(day) {} friend std::ostream &operator<<(std::ostream &os, const Date &d) { return os << d.year_ << '-' << d.month_ << '-' << d.day_; } }; std::string s = fmt::format("The date is {}", Date(2012, 12, 9)); // s == "The date is 2012-12-9" * Added support for `custom argument formatters `_ (`#235 `_). * Added support for locale-specific integer formatting with the ``n`` specifier (`#305 `_): .. code:: c++ std::setlocale(LC_ALL, "en_US.utf8"); fmt::print("cppformat: {:n}\n", 1234567); // prints 1,234,567 * Sign is now preserved when formatting an integer with an incorrect ``printf`` format specifier (`#265 `_): .. code:: c++ fmt::printf("%lld", -42); // prints -42 Note that it would be an undefined behavior in ``std::printf``. * Length modifiers such as ``ll`` are now optional in printf formatting functions and the correct type is determined automatically (`#255 `_): .. code:: c++ fmt::printf("%d", std::numeric_limits::max()); Note that it would be an undefined behavior in ``std::printf``. * Added initial support for custom formatters (`#231 `_). * Fixed detection of user-defined literal support on Intel C++ compiler (`#311 `_, `#312 `_). Thanks to `@dean0x7d (Dean Moldovan) `_ and `@speth (Ray Speth) `_. * Reduced compile time (`#243 `_, `#249 `_, `#317 `_): .. image:: https://cloud.githubusercontent.com/assets/4831417/11614060/ b9e826d2-9c36-11e5-8666-d4131bf503ef.png .. image:: https://cloud.githubusercontent.com/assets/4831417/11614080/ 6ac903cc-9c37-11e5-8165-26df6efae364.png Thanks to `@dean0x7d (Dean Moldovan) `_. * Compile test fixes (`#313 `_). Thanks to `@dean0x7d (Dean Moldovan) `_. * Documentation fixes (`#239 `_, `#248 `_, `#252 `_, `#258 `_, `#260 `_, `#301 `_, `#309 `_). Thanks to `@ReadmeCritic `_ `@Gachapen (Magnus Bjerke Vik) `_ and `@jwilk (Jakub Wilk) `_. * Fixed compiler and sanitizer warnings ( `#244 `_, `#256 `_, `#259 `_, `#263 `_, `#274 `_, `#277 `_, `#286 `_, `#291 `_, `#296 `_, `#308 `_) Thanks to `@mwinterb `_, `@pweiskircher (Patrik Weiskircher) `_, `@Naios `_. * Improved compatibility with Windows Store apps (`#280 `_, `#285 `_) Thanks to `@mwinterb `_. * Added tests of compatibility with older C++ standards (`#273 `_). Thanks to `@niosHD `_. * Fixed Android build (`#271 `_). Thanks to `@newnon `_. * Changed ``ArgMap`` to be backed by a vector instead of a map. (`#261 `_, `#262 `_). Thanks to `@mwinterb `_. * Added ``fprintf`` overload that writes to a ``std::ostream`` (`#251 `_). Thanks to `nickhutchinson (Nicholas Hutchinson) `_. * Export symbols when building a Windows DLL (`#245 `_). Thanks to `macdems (Maciek Dems) `_. * Fixed compilation on Cygwin (`#304 `_). * Implemented a workaround for a bug in Apple LLVM version 4.2 of clang (`#276 `_). * Implemented a workaround for Google Test bug `#705 `_ on gcc 6 (`#268 `_). Thanks to `octoploid `_. * Removed Biicode support because the latter has been discontinued. 2.1.1 - 2016-04-11 ------------------ * The install location for generated CMake files is now configurable via the ``FMT_CMAKE_DIR`` CMake variable (`#299 `_). Thanks to `@niosHD `_. * Documentation fixes (`#252 `_). 2.1.0 - 2016-03-21 ------------------ * Project layout and build system improvements (`#267 `_): * The code have been moved to the ``cppformat`` directory. Including ``format.h`` from the top-level directory is deprecated but works via a proxy header which will be removed in the next major version. * C++ Format CMake targets now have proper interface definitions. * Installed version of the library now supports the header-only configuration. * Targets ``doc``, ``install``, and ``test`` are now disabled if C++ Format is included as a CMake subproject. They can be enabled by setting ``FMT_DOC``, ``FMT_INSTALL``, and ``FMT_TEST`` in the parent project. Thanks to `@niosHD `_. 2.0.1 - 2016-03-13 ------------------ * Improved CMake find and package support (`#264 `_). Thanks to `@niosHD `_. * Fix compile error with Android NDK and mingw32 (`#241 `_). Thanks to `@Gachapen (Magnus Bjerke Vik) `_. * Documentation fixes (`#248 `_, `#260 `_). 2.0.0 - 2015-12-01 ------------------ General ~~~~~~~ * [Breaking] Named arguments (`#169 `_, `#173 `_, `#174 `_): .. code:: c++ fmt::print("The answer is {answer}.", fmt::arg("answer", 42)); Thanks to `@jamboree `_. * [Experimental] User-defined literals for format and named arguments (`#204 `_, `#206 `_, `#207 `_): .. code:: c++ using namespace fmt::literals; fmt::print("The answer is {answer}.", "answer"_a=42); Thanks to `@dean0x7d (Dean Moldovan) `_. * [Breaking] Formatting of more than 16 arguments is now supported when using variadic templates (`#141 `_). Thanks to `@Shauren `_. * Runtime width specification (`#168 `_): .. code:: c++ fmt::format("{0:{1}}", 42, 5); // gives " 42" Thanks to `@jamboree `_. * [Breaking] Enums are now formatted with an overloaded ``std::ostream`` insertion operator (``operator<<``) if available (`#232 `_). * [Breaking] Changed default ``bool`` format to textual, "true" or "false" (`#170 `_): .. code:: c++ fmt::print("{}", true); // prints "true" To print ``bool`` as a number use numeric format specifier such as ``d``: .. code:: c++ fmt::print("{:d}", true); // prints "1" * ``fmt::printf`` and ``fmt::sprintf`` now support formatting of ``bool`` with the ``%s`` specifier giving textual output, "true" or "false" (`#223 `_): .. code:: c++ fmt::printf("%s", true); // prints "true" Thanks to `@LarsGullik `_. * [Breaking] ``signed char`` and ``unsigned char`` are now formatted as integers by default (`#217 `_). * [Breaking] Pointers to C strings can now be formatted with the ``p`` specifier (`#223 `_): .. code:: c++ fmt::print("{:p}", "test"); // prints pointer value Thanks to `@LarsGullik `_. * [Breaking] ``fmt::printf`` and ``fmt::sprintf`` now print null pointers as ``(nil)`` and null strings as ``(null)`` for consistency with glibc (`#226 `_). Thanks to `@LarsGullik `_. * [Breaking] ``fmt::(s)printf`` now supports formatting of objects of user-defined types that provide an overloaded ``std::ostream`` insertion operator (``operator<<``) (`#201 `_): .. code:: c++ fmt::printf("The date is %s", Date(2012, 12, 9)); * [Breaking] The ``Buffer`` template is now part of the public API and can be used to implement custom memory buffers (`#140 `_). Thanks to `@polyvertex (Jean-Charles Lefebvre) `_. * [Breaking] Improved compatibility between ``BasicStringRef`` and `std::experimental::basic_string_view `_ (`#100 `_, `#159 `_, `#183 `_): - Comparison operators now compare string content, not pointers - ``BasicStringRef::c_str`` replaced by ``BasicStringRef::data`` - ``BasicStringRef`` is no longer assumed to be null-terminated References to null-terminated strings are now represented by a new class, ``BasicCStringRef``. * Dependency on pthreads introduced by Google Test is now optional (`#185 `_). * New CMake options ``FMT_DOC``, ``FMT_INSTALL`` and ``FMT_TEST`` to control generation of ``doc``, ``install`` and ``test`` targets respectively, on by default (`#197 `_, `#198 `_, `#200 `_). Thanks to `@maddinat0r (Alex Martin) `_. * ``noexcept`` is now used when compiling with MSVC2015 (`#215 `_). Thanks to `@dmkrepo (Dmitriy) `_. * Added an option to disable use of ``windows.h`` when ``FMT_USE_WINDOWS_H`` is defined as 0 before including ``format.h`` (`#171 `_). Thanks to `@alfps (Alf P. Steinbach) `_. * [Breaking] ``windows.h`` is now included with ``NOMINMAX`` unless ``FMT_WIN_MINMAX`` is defined. This is done to prevent breaking code using ``std::min`` and ``std::max`` and only affects the header-only configuration (`#152 `_, `#153 `_, `#154 `_). Thanks to `@DevO2012 `_. * Improved support for custom character types (`#171 `_). Thanks to `@alfps (Alf P. Steinbach) `_. * Added an option to disable use of IOStreams when ``FMT_USE_IOSTREAMS`` is defined as 0 before including ``format.h`` (`#205 `_, `#208 `_). Thanks to `@JodiTheTigger `_. * Improved detection of ``isnan``, ``isinf`` and ``signbit``. Optimization ~~~~~~~~~~~~ * Made formatting of user-defined types more efficient with a custom stream buffer (`#92 `_, `#230 `_). Thanks to `@NotImplemented `_. * Further improved performance of ``fmt::Writer`` on integer formatting and fixed a minor regression. Now it is ~7% faster than ``karma::generate`` on Karma's benchmark (`#186 `_). * [Breaking] Reduced `compiled code size `_ (`#143 `_, `#149 `_). Distribution ~~~~~~~~~~~~ * [Breaking] Headers are now installed in ``${CMAKE_INSTALL_PREFIX}/include/cppformat`` (`#178 `_). Thanks to `@jackyf (Eugene V. Lyubimkin) `_. * [Breaking] Changed the library name from ``format`` to ``cppformat`` for consistency with the project name and to avoid potential conflicts (`#178 `_). Thanks to `@jackyf (Eugene V. Lyubimkin) `_. * C++ Format is now available in `Debian `_ GNU/Linux (`stretch `_, `sid `_) and derived distributions such as `Ubuntu `_ 15.10 and later (`#155 `_):: $ sudo apt-get install libcppformat1-dev Thanks to `@jackyf (Eugene V. Lyubimkin) `_. * `Packages for Fedora and RHEL `_ are now available. Thanks to Dave Johansen. * C++ Format can now be installed via `Homebrew `_ on OS X (`#157 `_):: $ brew install cppformat Thanks to `@ortho `_, Anatoliy Bulukin. Documentation ~~~~~~~~~~~~~ * Migrated from ReadTheDocs to GitHub Pages for better responsiveness and reliability (`#128 `_). New documentation address is http://cppformat.github.io/. * Added `Building the documentation `_ section to the documentation. * Documentation build script is now compatible with Python 3 and newer pip versions. (`#189 `_, `#209 `_). Thanks to `@JodiTheTigger `_ and `@xentec `_. * Documentation fixes and improvements (`#36 `_, `#75 `_, `#125 `_, `#160 `_, `#161 `_, `#162 `_, `#165 `_, `#210 `_). Thanks to `@syohex (Syohei YOSHIDA) `_ and bug reporters. * Fixed out-of-tree documentation build (`#177 `_). Thanks to `@jackyf (Eugene V. Lyubimkin) `_. Fixes ~~~~~ * Fixed ``initializer_list`` detection (`#136 `_). Thanks to `@Gachapen (Magnus Bjerke Vik) `_. * [Breaking] Fixed formatting of enums with numeric format specifiers in ``fmt::(s)printf`` (`#131 `_, `#139 `_): .. code:: c++ enum { ANSWER = 42 }; fmt::printf("%d", ANSWER); Thanks to `@Naios `_. * Improved compatibility with old versions of MinGW (`#129 `_, `#130 `_, `#132 `_). Thanks to `@cstamford (Christopher Stamford) `_. * Fixed a compile error on MSVC with disabled exceptions (`#144 `_). * Added a workaround for broken implementation of variadic templates in MSVC2012 (`#148 `_). * Placed the anonymous namespace within ``fmt`` namespace for the header-only configuration (`#171 `_). Thanks to `@alfps (Alf P. Steinbach) `_. * Fixed issues reported by Coverity Scan (`#187 `_, `#192 `_). * Implemented a workaround for a name lookup bug in MSVC2010 (`#188 `_). * Fixed compiler warnings (`#95 `_, `#96 `_, `#114 `_, `#135 `_, `#142 `_, `#145 `_, `#146 `_, `#158 `_, `#163 `_, `#175 `_, `#190 `_, `#191 `_, `#194 `_, `#196 `_, `#216 `_, `#218 `_, `#220 `_, `#229 `_, `#233 `_, `#234 `_, `#236 `_, `#281 `_, `#289 `_). Thanks to `@seanmiddleditch (Sean Middleditch) `_, `@dixlorenz (Dix Lorenz) `_, `@CarterLi (李通洲) `_, `@Naios `_, `@fmatthew5876 (Matthew Fioravante) `_, `@LevskiWeng (Levski Weng) `_, `@rpopescu `_, `@gabime (Gabi Melman) `_, `@cubicool (Jeremy Moles) `_, `@jkflying (Julian Kent) `_, `@LogicalKnight (Sean L) `_, `@inguin (Ingo van Lil) `_ and `@Jopie64 (Johan) `_. * Fixed portability issues (mostly causing test failures) on ARM, ppc64, ppc64le, s390x and SunOS 5.11 i386 ( `#138 `_, `#179 `_, `#180 `_, `#202 `_, `#225 `_, `Red Hat Bugzilla Bug 1260297 `_). Thanks to `@Naios `_, `@jackyf (Eugene V. Lyubimkin) `_ and Dave Johansen. * Fixed a name conflict with macro ``free`` defined in ``crtdbg.h`` when ``_CRTDBG_MAP_ALLOC`` is set (`#211 `_). * Fixed shared library build on OS X (`#212 `_). Thanks to `@dean0x7d (Dean Moldovan) `_. * Fixed an overload conflict on MSVC when ``/Zc:wchar_t-`` option is specified (`#214 `_). Thanks to `@slavanap (Vyacheslav Napadovsky) `_. * Improved compatibility with MSVC 2008 (`#236 `_). Thanks to `@Jopie64 (Johan) `_. * Improved compatibility with bcc32 (`#227 `_). * Fixed ``static_assert`` detection on Clang (`#228 `_). Thanks to `@dean0x7d (Dean Moldovan) `_. 1.1.0 - 2015-03-06 ------------------ * Added ``BasicArrayWriter``, a class template that provides operations for formatting and writing data into a fixed-size array (`#105 `_ and `#122 `_): .. code:: c++ char buffer[100]; fmt::ArrayWriter w(buffer); w.write("The answer is {}", 42); * Added `0 A.D. `_ and `PenUltima Online (POL) `_ to the list of notable projects using C++ Format. * C++ Format now uses MSVC intrinsics for better formatting performance (`#115 `_, `#116 `_, `#118 `_ and `#121 `_). Previously these optimizations where only used on GCC and Clang. Thanks to `@CarterLi `_ and `@objectx `_. * CMake install target (`#119 `_). Thanks to `@TrentHouliston `_. You can now install C++ Format with ``make install`` command. * Improved `Biicode `_ support (`#98 `_ and `#104 `_). Thanks to `@MariadeAnton `_ and `@franramirez688 `_. * Improved support for building with `Android NDK `_ (`#107 `_). Thanks to `@newnon `_. The `android-ndk-example `_ repository provides and example of using C++ Format with Android NDK: .. image:: https://raw.githubusercontent.com/fmtlib/android-ndk-example/ master/screenshot.png * Improved documentation of ``SystemError`` and ``WindowsError`` (`#54 `_). * Various code improvements (`#110 `_, `#111 `_ `#112 `_). Thanks to `@CarterLi `_. * Improved compile-time errors when formatting wide into narrow strings (`#117 `_). * Fixed ``BasicWriter::write`` without formatting arguments when C++11 support is disabled (`#109 `_). * Fixed header-only build on OS X with GCC 4.9 (`#124 `_). * Fixed packaging issues (`#94 `_). * Added `changelog `_ (`#103 `_). 1.0.0 - 2015-02-05 ------------------ * Add support for a header-only configuration when ``FMT_HEADER_ONLY`` is defined before including ``format.h``: .. code:: c++ #define FMT_HEADER_ONLY #include "format.h" * Compute string length in the constructor of ``BasicStringRef`` instead of the ``size`` method (`#79 `_). This eliminates size computation for string literals on reasonable optimizing compilers. * Fix formatting of types with overloaded ``operator <<`` for ``std::wostream`` (`#86 `_): .. code:: c++ fmt::format(L"The date is {0}", Date(2012, 12, 9)); * Fix linkage of tests on Arch Linux (`#89 `_). * Allow precision specifier for non-float arguments (`#90 `_): .. code:: c++ fmt::print("{:.3}\n", "Carpet"); // prints "Car" * Fix build on Android NDK (`#93 `_) * Improvements to documentation build procedure. * Remove ``FMT_SHARED`` CMake variable in favor of standard `BUILD_SHARED_LIBS `_. * Fix error handling in ``fmt::fprintf``. * Fix a number of warnings. 0.12.0 - 2014-10-25 ------------------- * [Breaking] Improved separation between formatting and buffer management. ``Writer`` is now a base class that cannot be instantiated directly. The new ``MemoryWriter`` class implements the default buffer management with small allocations done on stack. So ``fmt::Writer`` should be replaced with ``fmt::MemoryWriter`` in variable declarations. Old code: .. code:: c++ fmt::Writer w; New code: .. code:: c++ fmt::MemoryWriter w; If you pass ``fmt::Writer`` by reference, you can continue to do so: .. code:: c++ void f(fmt::Writer &w); This doesn't affect the formatting API. * Support for custom memory allocators (`#69 `_) * Formatting functions now accept `signed char` and `unsigned char` strings as arguments (`#73 `_): .. code:: c++ auto s = format("GLSL version: {}", glGetString(GL_VERSION)); * Reduced code bloat. According to the new `benchmark results `_, cppformat is close to ``printf`` and by the order of magnitude better than Boost Format in terms of compiled code size. * Improved appearance of the documentation on mobile by using the `Sphinx Bootstrap theme `_: .. |old| image:: https://cloud.githubusercontent.com/assets/576385/4792130/ cd256436-5de3-11e4-9a62-c077d0c2b003.png .. |new| image:: https://cloud.githubusercontent.com/assets/576385/4792131/ cd29896c-5de3-11e4-8f59-cac952942bf0.png +-------+-------+ | Old | New | +-------+-------+ | |old| | |new| | +-------+-------+ 0.11.0 - 2014-08-21 ------------------- * Safe printf implementation with a POSIX extension for positional arguments: .. code:: c++ fmt::printf("Elapsed time: %.2f seconds", 1.23); fmt::printf("%1$s, %3$d %2$s", weekday, month, day); * Arguments of ``char`` type can now be formatted as integers (Issue `#55 `_): .. code:: c++ fmt::format("0x{0:02X}", 'a'); * Deprecated parts of the API removed. * The library is now built and tested on MinGW with Appveyor in addition to existing test platforms Linux/GCC, OS X/Clang, Windows/MSVC. 0.10.0 - 2014-07-01 ------------------- **Improved API** * All formatting methods are now implemented as variadic functions instead of using ``operator<<`` for feeding arbitrary arguments into a temporary formatter object. This works both with C++11 where variadic templates are used and with older standards where variadic functions are emulated by providing lightweight wrapper functions defined with the ``FMT_VARIADIC`` macro. You can use this macro for defining your own portable variadic functions: .. code:: c++ void report_error(const char *format, const fmt::ArgList &args) { fmt::print("Error: {}"); fmt::print(format, args); } FMT_VARIADIC(void, report_error, const char *) report_error("file not found: {}", path); Apart from a more natural syntax, this also improves performance as there is no need to construct temporary formatter objects and control arguments' lifetimes. Because the wrapper functions are very lightweight, this doesn't cause code bloat even in pre-C++11 mode. * Simplified common case of formatting an ``std::string``. Now it requires a single function call: .. code:: c++ std::string s = format("The answer is {}.", 42); Previously it required 2 function calls: .. code:: c++ std::string s = str(Format("The answer is {}.") << 42); Instead of unsafe ``c_str`` function, ``fmt::Writer`` should be used directly to bypass creation of ``std::string``: .. code:: c++ fmt::Writer w; w.write("The answer is {}.", 42); w.c_str(); // returns a C string This doesn't do dynamic memory allocation for small strings and is less error prone as the lifetime of the string is the same as for ``std::string::c_str`` which is well understood (hopefully). * Improved consistency in naming functions that are a part of the public API. Now all public functions are lowercase following the standard library conventions. Previously it was a combination of lowercase and CapitalizedWords. Issue `#50 `_. * Old functions are marked as deprecated and will be removed in the next release. **Other Changes** * Experimental support for printf format specifications (work in progress): .. code:: c++ fmt::printf("The answer is %d.", 42); std::string s = fmt::sprintf("Look, a %s!", "string"); * Support for hexadecimal floating point format specifiers ``a`` and ``A``: .. code:: c++ print("{:a}", -42.0); // Prints -0x1.5p+5 print("{:A}", -42.0); // Prints -0X1.5P+5 * CMake option ``FMT_SHARED`` that specifies whether to build format as a shared library (off by default). 0.9.0 - 2014-05-13 ------------------ * More efficient implementation of variadic formatting functions. * ``Writer::Format`` now has a variadic overload: .. code:: c++ Writer out; out.Format("Look, I'm {}!", "variadic"); * For efficiency and consistency with other overloads, variadic overload of the ``Format`` function now returns ``Writer`` instead of ``std::string``. Use the ``str`` function to convert it to ``std::string``: .. code:: c++ std::string s = str(Format("Look, I'm {}!", "variadic")); * Replaced formatter actions with output sinks: ``NoAction`` -> ``NullSink``, ``Write`` -> ``FileSink``, ``ColorWriter`` -> ``ANSITerminalSink``. This improves naming consistency and shouldn't affect client code unless these classes are used directly which should be rarely needed. * Added ``ThrowSystemError`` function that formats a message and throws ``SystemError`` containing the formatted message and system-specific error description. For example, the following code .. code:: c++ FILE *f = fopen(filename, "r"); if (!f) ThrowSystemError(errno, "Failed to open file '{}'") << filename; will throw ``SystemError`` exception with description "Failed to open file '': No such file or directory" if file doesn't exist. * Support for AppVeyor continuous integration platform. * ``Format`` now throws ``SystemError`` in case of I/O errors. * Improve test infrastructure. Print functions are now tested by redirecting the output to a pipe. 0.8.0 - 2014-04-14 ------------------ * Initial release