ChangeLog.rst 141 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665
  1. 7.1.3 - 2020-11-24
  2. ------------------
  3. * Fixed handling of buffer boundaries in ``format_to_n``
  4. (`#1996 <https://github.com/fmtlib/fmt/issues/1996>`_,
  5. `#2029 <https://github.com/fmtlib/fmt/issues/2029>`_).
  6. * Fixed linkage errors when linking with a shared library
  7. (`#2011 <https://github.com/fmtlib/fmt/issues/2011>`_).
  8. * Reintroduced ostream support to range formatters
  9. (`#2014 <https://github.com/fmtlib/fmt/issues/2014>`_).
  10. * Worked around an issue with mixing std versions in gcc
  11. (`#2017 <https://github.com/fmtlib/fmt/issues/2017>`_).
  12. 7.1.2 - 2020-11-04
  13. ------------------
  14. * Fixed floating point formatting with large precision
  15. (`#1976 <https://github.com/fmtlib/fmt/issues/1976>`_).
  16. 7.1.1 - 2020-11-01
  17. ------------------
  18. * Fixed ABI compatibility with 7.0.x
  19. (`#1961 <https://github.com/fmtlib/fmt/issues/1961>`_).
  20. * Added the ``FMT_ARM_ABI_COMPATIBILITY`` macro to work around ABI
  21. incompatibility between GCC and Clang on ARM
  22. (`#1919 <https://github.com/fmtlib/fmt/issues/1919>`_).
  23. * Worked around a SFINAE bug in GCC 8
  24. (`#1957 <https://github.com/fmtlib/fmt/issues/1957>`_).
  25. * Fixed linkage errors when building with GCC's LTO
  26. (`#1955 <https://github.com/fmtlib/fmt/issues/1955>`_).
  27. * Fixed a compilation error when building without ``__builtin_clz`` or equivalent
  28. (`#1968 <https://github.com/fmtlib/fmt/pull/1968>`_).
  29. Thanks `@tohammer (Tobias Hammer) <https://github.com/tohammer>`_.
  30. * Fixed a sign conversion warning
  31. (`#1964 <https://github.com/fmtlib/fmt/pull/1964>`_).
  32. Thanks `@OptoCloud <https://github.com/OptoCloud>`_.
  33. 7.1.0 - 2020-10-25
  34. ------------------
  35. * Switched from `Grisu3
  36. <https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf>`_
  37. to `Dragonbox <https://github.com/jk-jeon/dragonbox>`_ for the default
  38. floating-point formatting which gives the shortest decimal representation
  39. with round-trip guarantee and correct rounding
  40. (`#1882 <https://github.com/fmtlib/fmt/pull/1882>`_,
  41. `#1887 <https://github.com/fmtlib/fmt/pull/1887>`_,
  42. `#1894 <https://github.com/fmtlib/fmt/pull/1894>`_). This makes {fmt} up to
  43. 20-30x faster than common implementations of ``std::ostringstream`` and
  44. ``sprintf`` on `dtoa-benchmark <https://github.com/fmtlib/dtoa-benchmark>`_
  45. and faster than double-conversion and Ryū:
  46. .. image:: https://user-images.githubusercontent.com/576385/
  47. 95684665-11719600-0ba8-11eb-8e5b-972ff4e49428.png
  48. It is possible to get even better performance at the cost of larger binary
  49. size by compiling with the ``FMT_USE_FULL_CACHE_DRAGONBOX`` macro set to 1.
  50. Thanks `@jk-jeon (Junekey Jeon) <https://github.com/jk-jeon>`_.
  51. * Added an experimental unsynchronized file output API which, together with
  52. `format string compilation <https://fmt.dev/latest/api.html#compile-api>`_,
  53. can give `5-9 times speed up compared to fprintf
  54. <https://www.zverovich.net/2020/08/04/optimal-file-buffer-size.html>`_
  55. on common platforms (`godbolt <https://godbolt.org/z/nsTcG8>`__):
  56. .. code:: c++
  57. #include <fmt/os.h>
  58. int main() {
  59. auto f = fmt::output_file("guide");
  60. f.print("The answer is {}.", 42);
  61. }
  62. * Added a formatter for ``std::chrono::time_point<system_clock>``
  63. (`#1819 <https://github.com/fmtlib/fmt/issues/1819>`_,
  64. `#1837 <https://github.com/fmtlib/fmt/pull/1837>`_). For example
  65. (`godbolt <https://godbolt.org/z/c4M6fh>`__):
  66. .. code:: c++
  67. #include <fmt/chrono.h>
  68. int main() {
  69. auto now = std::chrono::system_clock::now();
  70. fmt::print("The time is {:%H:%M:%S}.\n", now);
  71. }
  72. Thanks `@adamburgess (Adam Burgess) <https://github.com/adamburgess>`_.
  73. * Added support for ranges with non-const ``begin``/``end`` to ``fmt::join``
  74. (`#1784 <https://github.com/fmtlib/fmt/issues/1784>`_,
  75. `#1786 <https://github.com/fmtlib/fmt/pull/1786>`_). For example
  76. (`godbolt <https://godbolt.org/z/jP63Tv>`__):
  77. .. code:: c++
  78. #include <fmt/ranges.h>
  79. #include <range/v3/view/filter.hpp>
  80. int main() {
  81. using std::literals::string_literals::operator""s;
  82. auto strs = std::array{"a"s, "bb"s, "ccc"s};
  83. auto range = strs | ranges::views::filter(
  84. [] (const std::string &x) { return x.size() != 2; }
  85. );
  86. fmt::print("{}\n", fmt::join(range, ""));
  87. }
  88. prints "accc".
  89. Thanks `@tonyelewis (Tony E Lewis) <https://github.com/tonyelewis>`_.
  90. * Added a ``memory_buffer::append`` overload that takes a range
  91. (`#1806 <https://github.com/fmtlib/fmt/pull/1806>`_).
  92. Thanks `@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.
  93. * Improved handling of single code units in ``FMT_COMPILE``. For example:
  94. .. code:: c++
  95. #include <fmt/compile.h>
  96. char* f(char* buf) {
  97. return fmt::format_to(buf, FMT_COMPILE("x{}"), 42);
  98. }
  99. compiles to just (`godbolt <https://godbolt.org/z/5vncz3>`__):
  100. .. code:: asm
  101. _Z1fPc:
  102. movb $120, (%rdi)
  103. xorl %edx, %edx
  104. cmpl $42, _ZN3fmt2v76detail10basic_dataIvE23zero_or_powers_of_10_32E+8(%rip)
  105. movl $3, %eax
  106. seta %dl
  107. subl %edx, %eax
  108. movzwl _ZN3fmt2v76detail10basic_dataIvE6digitsE+84(%rip), %edx
  109. cltq
  110. addq %rdi, %rax
  111. movw %dx, -2(%rax)
  112. ret
  113. Here a single ``mov`` instruction writes ``'x'`` (``$120``) to the output
  114. buffer.
  115. * Added dynamic width support to format string compilation
  116. (`#1809 <https://github.com/fmtlib/fmt/issues/1809>`_).
  117. * Improved error reporting for unformattable types: now you'll get the type name
  118. directly in the error message instead of the note:
  119. .. code:: c++
  120. #include <fmt/core.h>
  121. struct how_about_no {};
  122. int main() {
  123. fmt::print("{}", how_about_no());
  124. }
  125. Error (`godbolt <https://godbolt.org/z/GoxM4e>`__):
  126. ``fmt/core.h:1438:3: error: static_assert failed due to requirement
  127. 'fmt::v7::formattable<how_about_no>()' "Cannot format an argument.
  128. To make type T formattable provide a formatter<T> specialization:
  129. https://fmt.dev/latest/api.html#udt"
  130. ...``
  131. * Added the `make_args_checked <https://fmt.dev/7.1.0/api.html#argument-lists>`_
  132. function template that allows you to write formatting functions with
  133. compile-time format string checks and avoid binary code bloat
  134. (`godbolt <https://godbolt.org/z/PEf9qr>`__):
  135. .. code:: c++
  136. void vlog(const char* file, int line, fmt::string_view format,
  137. fmt::format_args args) {
  138. fmt::print("{}: {}: ", file, line);
  139. fmt::vprint(format, args);
  140. }
  141. template <typename S, typename... Args>
  142. void log(const char* file, int line, const S& format, Args&&... args) {
  143. vlog(file, line, format,
  144. fmt::make_args_checked<Args...>(format, args...));
  145. }
  146. #define MY_LOG(format, ...) \
  147. log(__FILE__, __LINE__, FMT_STRING(format), __VA_ARGS__)
  148. MY_LOG("invalid squishiness: {}", 42);
  149. * Replaced ``snprintf`` fallback with a faster internal IEEE 754 ``float`` and
  150. ``double`` formatter for arbitrary precision. For example
  151. (`godbolt <https://godbolt.org/z/dPhWvj>`__):
  152. .. code:: c++
  153. #include <fmt/core.h>
  154. int main() {
  155. fmt::print("{:.500}\n", 4.9406564584124654E-324);
  156. }
  157. prints
  158. ``4.9406564584124654417656879286822137236505980261432476442558568250067550727020875186529983636163599237979656469544571773092665671035593979639877479601078187812630071319031140452784581716784898210368871863605699873072305000638740915356498438731247339727316961514003171538539807412623856559117102665855668676818703956031062493194527159149245532930545654440112748012970999954193198940908041656332452475714786901472678015935523861155013480352649347201937902681071074917033322268447533357208324319360923829e-324``.
  159. * Made ``format_to_n`` and ``formatted_size`` part of the `core API
  160. <https://fmt.dev/latest/api.html#core-api>`__
  161. (`godbolt <https://godbolt.org/z/sPjY1K>`__):
  162. .. code:: c++
  163. #include <fmt/core.h>
  164. int main() {
  165. char buffer[10];
  166. auto result = fmt::format_to_n(buffer, sizeof(buffer), "{}", 42);
  167. }
  168. * Added ``fmt::format_to_n`` overload with format string compilation
  169. (`#1764 <https://github.com/fmtlib/fmt/issues/1764>`_,
  170. `#1767 <https://github.com/fmtlib/fmt/pull/1767>`_,
  171. `#1869 <https://github.com/fmtlib/fmt/pull/1869>`_). For example
  172. (`godbolt <https://godbolt.org/z/93h86q>`__):
  173. .. code:: c++
  174. #include <fmt/compile.h>
  175. int main() {
  176. char buffer[8];
  177. fmt::format_to_n(buffer, sizeof(buffer), FMT_COMPILE("{}"), 42);
  178. }
  179. Thanks `@Kurkin (Dmitry Kurkin) <https://github.com/Kurkin>`_,
  180. `@alexezeder (Alexey Ochapov) <https://github.com/alexezeder>`_.
  181. * Added ``fmt::format_to`` overload that take ``text_style``
  182. (`#1593 <https://github.com/fmtlib/fmt/issues/1593>`_,
  183. `#1842 <https://github.com/fmtlib/fmt/issues/1842>`_,
  184. `#1843 <https://github.com/fmtlib/fmt/pull/1843>`_). For example
  185. (`godbolt <https://godbolt.org/z/91153r>`__):
  186. .. code:: c++
  187. #include <fmt/color.h>
  188. int main() {
  189. std::string out;
  190. fmt::format_to(std::back_inserter(out),
  191. fmt::emphasis::bold | fg(fmt::color::red),
  192. "The answer is {}.", 42);
  193. }
  194. Thanks `@Naios (Denis Blank) <https://github.com/Naios>`_.
  195. * Made the ``#`` specifier emit trailing zeros in addition to the decimal point
  196. (`#1797 <https://github.com/fmtlib/fmt/issues/1797>`_). For example
  197. (`godbolt <https://godbolt.org/z/bhdcW9>`__):
  198. .. code:: c++
  199. #include <fmt/core.h>
  200. int main() {
  201. fmt::print("{:#.2g}", 0.5);
  202. }
  203. prints ``0.50``.
  204. * Changed the default floating point format to not include ``.0`` for
  205. consistency with ``std::format`` and ``std::to_chars``
  206. (`#1893 <https://github.com/fmtlib/fmt/issues/1893>`_,
  207. `#1943 <https://github.com/fmtlib/fmt/issues/1943>`_). It is possible to get
  208. the decimal point and trailing zero with the ``#`` specifier.
  209. * Fixed an issue with floating-point formatting that could result in addition of
  210. a non-significant trailing zero in rare cases e.g. ``1.00e-34`` instead of
  211. ``1.0e-34`` (`#1873 <https://github.com/fmtlib/fmt/issues/1873>`_,
  212. `#1917 <https://github.com/fmtlib/fmt/issues/1917>`_).
  213. * Made ``fmt::to_string`` fallback on ``ostream`` insertion operator if
  214. the ``formatter`` specialization is not provided
  215. (`#1815 <https://github.com/fmtlib/fmt/issues/1815>`_,
  216. `#1829 <https://github.com/fmtlib/fmt/pull/1829>`_).
  217. Thanks `@alexezeder (Alexey Ochapov) <https://github.com/alexezeder>`_.
  218. * Added support for the append mode to the experimental file API and
  219. improved ``fcntl.h`` detection.
  220. (`#1847 <https://github.com/fmtlib/fmt/pull/1847>`_,
  221. `#1848 <https://github.com/fmtlib/fmt/pull/1848>`_).
  222. Thanks `@t-wiser <https://github.com/t-wiser>`_.
  223. * Fixed handling of types that have both an implicit conversion operator and
  224. an overloaded ``ostream`` insertion operator
  225. (`#1766 <https://github.com/fmtlib/fmt/issues/1766>`_).
  226. * Fixed a slicing issue in an internal iterator type
  227. (`#1822 <https://github.com/fmtlib/fmt/pull/1822>`_).
  228. Thanks `@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.
  229. * Fixed an issue in locale-specific integer formatting
  230. (`#1927 <https://github.com/fmtlib/fmt/issues/1927>`_).
  231. * Fixed handling of exotic code unit types
  232. (`#1870 <https://github.com/fmtlib/fmt/issues/1870>`_,
  233. `#1932 <https://github.com/fmtlib/fmt/issues/1932>`_).
  234. * Improved ``FMT_ALWAYS_INLINE``
  235. (`#1878 <https://github.com/fmtlib/fmt/pull/1878>`_).
  236. Thanks `@jk-jeon (Junekey Jeon) <https://github.com/jk-jeon>`_.
  237. * Removed dependency on ``windows.h``
  238. (`#1900 <https://github.com/fmtlib/fmt/pull/1900>`_).
  239. Thanks `@bernd5 (Bernd Baumanns) <https://github.com/bernd5>`_.
  240. * Optimized counting of decimal digits on MSVC
  241. (`#1890 <https://github.com/fmtlib/fmt/pull/1890>`_).
  242. Thanks `@mwinterb <https://github.com/mwinterb>`_.
  243. * Improved documentation
  244. (`#1772 <https://github.com/fmtlib/fmt/issues/1772>`_,
  245. `#1775 <https://github.com/fmtlib/fmt/pull/1775>`_,
  246. `#1792 <https://github.com/fmtlib/fmt/pull/1792>`_,
  247. `#1838 <https://github.com/fmtlib/fmt/pull/1838>`_,
  248. `#1888 <https://github.com/fmtlib/fmt/pull/1888>`_,
  249. `#1918 <https://github.com/fmtlib/fmt/pull/1918>`_,
  250. `#1939 <https://github.com/fmtlib/fmt/pull/1939>`_).
  251. Thanks `@leolchat (Léonard Gérard) <https://github.com/leolchat>`_,
  252. `@pepsiman (Malcolm Parsons) <https://github.com/pepsiman>`_,
  253. `@Klaim (Joël Lamotte) <https://github.com/Klaim>`_,
  254. `@ravijanjam (Ravi J) <https://github.com/ravijanjam>`_,
  255. `@francesco-st <https://github.com/francesco-st>`_,
  256. `@udnaan (Adnan) <https://github.com/udnaan>`_.
  257. * Added the ``FMT_REDUCE_INT_INSTANTIATIONS`` CMake option that reduces the
  258. binary code size at the cost of some integer formatting performance. This can
  259. be useful for extremely memory-constrained embedded systems
  260. (`#1778 <https://github.com/fmtlib/fmt/issues/1778>`_,
  261. `#1781 <https://github.com/fmtlib/fmt/pull/1781>`_).
  262. Thanks `@kammce (Khalil Estell) <https://github.com/kammce>`_.
  263. * Added the ``FMT_USE_INLINE_NAMESPACES`` macro to control usage of inline
  264. namespaces (`#1945 <https://github.com/fmtlib/fmt/pull/1945>`_).
  265. Thanks `@darklukee <https://github.com/darklukee>`_.
  266. * Improved build configuration
  267. (`#1760 <https://github.com/fmtlib/fmt/pull/1760>`_,
  268. `#1770 <https://github.com/fmtlib/fmt/pull/1770>`_,
  269. `#1779 <https://github.com/fmtlib/fmt/issues/1779>`_,
  270. `#1783 <https://github.com/fmtlib/fmt/pull/1783>`_,
  271. `#1823 <https://github.com/fmtlib/fmt/pull/1823>`_).
  272. Thanks `@dvetutnev (Dmitriy Vetutnev) <https://github.com/dvetutnev>`_,
  273. `@xvitaly (Vitaly Zaitsev) <https://github.com/xvitaly>`_,
  274. `@tambry (Raul Tambre) <https://github.com/tambry>`_,
  275. `@medithe <https://github.com/medithe>`_,
  276. `@martinwuehrer (Martin Wührer) <https://github.com/martinwuehrer>`_.
  277. * Fixed various warnings and compilation issues
  278. (`#1790 <https://github.com/fmtlib/fmt/pull/1790>`_,
  279. `#1802 <https://github.com/fmtlib/fmt/pull/1802>`_,
  280. `#1808 <https://github.com/fmtlib/fmt/pull/1808>`_,
  281. `#1810 <https://github.com/fmtlib/fmt/issues/1810>`_,
  282. `#1811 <https://github.com/fmtlib/fmt/issues/1811>`_,
  283. `#1812 <https://github.com/fmtlib/fmt/pull/1812>`_,
  284. `#1814 <https://github.com/fmtlib/fmt/pull/1814>`_,
  285. `#1816 <https://github.com/fmtlib/fmt/pull/1816>`_,
  286. `#1817 <https://github.com/fmtlib/fmt/pull/1817>`_,
  287. `#1818 <https://github.com/fmtlib/fmt/pull/1818>`_,
  288. `#1825 <https://github.com/fmtlib/fmt/issues/1825>`_,
  289. `#1836 <https://github.com/fmtlib/fmt/pull/1836>`_,
  290. `#1855 <https://github.com/fmtlib/fmt/pull/1855>`_,
  291. `#1856 <https://github.com/fmtlib/fmt/pull/1856>`_,
  292. `#1860 <https://github.com/fmtlib/fmt/pull/1860>`_,
  293. `#1877 <https://github.com/fmtlib/fmt/pull/1877>`_,
  294. `#1879 <https://github.com/fmtlib/fmt/pull/1879>`_,
  295. `#1880 <https://github.com/fmtlib/fmt/pull/1880>`_,
  296. `#1896 <https://github.com/fmtlib/fmt/issues/1896>`_,
  297. `#1897 <https://github.com/fmtlib/fmt/pull/1897>`_,
  298. `#1898 <https://github.com/fmtlib/fmt/pull/1898>`_,
  299. `#1904 <https://github.com/fmtlib/fmt/issues/1904>`_,
  300. `#1908 <https://github.com/fmtlib/fmt/pull/1908>`_,
  301. `#1911 <https://github.com/fmtlib/fmt/issues/1911>`_,
  302. `#1912 <https://github.com/fmtlib/fmt/issues/1912>`_,
  303. `#1928 <https://github.com/fmtlib/fmt/issues/1928>`_,
  304. `#1929 <https://github.com/fmtlib/fmt/pull/1929>`_,
  305. `#1935 <https://github.com/fmtlib/fmt/issues/1935>`_
  306. `#1937 <https://github.com/fmtlib/fmt/pull/1937>`_,
  307. `#1942 <https://github.com/fmtlib/fmt/pull/1942>`_,
  308. `#1949 <https://github.com/fmtlib/fmt/issues/1949>`_).
  309. Thanks `@TheQwertiest <https://github.com/TheQwertiest>`_,
  310. `@medithe <https://github.com/medithe>`_,
  311. `@martinwuehrer (Martin Wührer) <https://github.com/martinwuehrer>`_,
  312. `@n16h7hunt3r <https://github.com/n16h7hunt3r>`_,
  313. `@Othereum (Seokjin Lee) <https://github.com/Othereum>`_,
  314. `@gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>`_,
  315. `@AlexanderLanin (Alexander Lanin) <https://github.com/AlexanderLanin>`_,
  316. `@gcerretani (Giovanni Cerretani) <https://github.com/gcerretani>`_,
  317. `@chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>`_,
  318. `@noizefloor (Jan Schwers) <https://github.com/noizefloor>`_,
  319. `@akohlmey (Axel Kohlmeyer) <https://github.com/akohlmey>`_,
  320. `@jk-jeon (Junekey Jeon) <https://github.com/jk-jeon>`_,
  321. `@rimathia <https://github.com/rimathia>`_,
  322. `@rglarix (Riccardo Ghetta (larix)) <https://github.com/rglarix>`_,
  323. `@moiwi <https://github.com/moiwi>`_,
  324. `@heckad (Kazantcev Andrey) <https://github.com/heckad>`_,
  325. `@MarcDirven <https://github.com/MarcDirven>`_.
  326. `@BartSiwek (Bart Siwek) <https://github.com/BartSiwek>`_,
  327. `@darklukee <https://github.com/darklukee>`_.
  328. 7.0.3 - 2020-08-06
  329. ------------------
  330. * Worked around broken ``numeric_limits`` for 128-bit integers
  331. (`#1787 <https://github.com/fmtlib/fmt/issues/1787>`_).
  332. * Added error reporting on missing named arguments
  333. (`#1796 <https://github.com/fmtlib/fmt/issues/1796>`_).
  334. * Stopped using 128-bit integers with clang-cl
  335. (`#1800 <https://github.com/fmtlib/fmt/pull/1800>`_).
  336. Thanks `@Kingcom <https://github.com/Kingcom>`_.
  337. * Fixed issues in locale-specific integer formatting
  338. (`#1782 <https://github.com/fmtlib/fmt/issues/1782>`_,
  339. `#1801 <https://github.com/fmtlib/fmt/issues/1801>`_).
  340. 7.0.2 - 2020-07-29
  341. ------------------
  342. * Worked around broken ``numeric_limits`` for 128-bit integers
  343. (`#1725 <https://github.com/fmtlib/fmt/issues/1725>`_).
  344. * Fixed compatibility with CMake 3.4
  345. (`#1779 <https://github.com/fmtlib/fmt/issues/1779>`_).
  346. * Fixed handling of digit separators in locale-specific formatting
  347. (`#1782 <https://github.com/fmtlib/fmt/issues/1782>`_).
  348. 7.0.1 - 2020-07-07
  349. ------------------
  350. * Updated the inline version namespace name.
  351. * Worked around a gcc bug in mangling of alias templates
  352. (`#1753 <https://github.com/fmtlib/fmt/issues/1753>`_).
  353. * Fixed a linkage error on Windows
  354. (`#1757 <https://github.com/fmtlib/fmt/issues/1757>`_).
  355. Thanks `@Kurkin (Dmitry Kurkin) <https://github.com/Kurkin>`_.
  356. * Fixed minor issues with the documentation.
  357. 7.0.0 - 2020-07-05
  358. ------------------
  359. * Reduced the library size. For example, on macOS a stripped test binary
  360. statically linked with {fmt} `shrank from ~368k to less than 100k
  361. <http://www.zverovich.net/2020/05/21/reducing-library-size.html>`_.
  362. * Added a simpler and more efficient `format string compilation API
  363. <https://fmt.dev/7.0.0/api.html#compile-api>`_:
  364. .. code:: c++
  365. #include <fmt/compile.h>
  366. // Converts 42 into std::string using the most efficient method and no
  367. // runtime format string processing.
  368. std::string s = fmt::format(FMT_COMPILE("{}"), 42);
  369. The old ``fmt::compile`` API is now deprecated.
  370. * Optimized integer formatting: ``format_to`` with format string compilation
  371. and a stack-allocated buffer is now `faster than to_chars on both
  372. libc++ and libstdc++
  373. <http://www.zverovich.net/2020/06/13/fast-int-to-string-revisited.html>`_.
  374. * Optimized handling of small format strings. For example,
  375. .. code:: c++
  376. fmt::format("Result: {}: ({},{},{},{})", str1, str2, str3, str4, str5)
  377. is now ~40% faster (`#1685 <https://github.com/fmtlib/fmt/issues/1685>`_).
  378. * Applied extern templates to improve compile times when using the core API
  379. and ``fmt/format.h`` (`#1452 <https://github.com/fmtlib/fmt/issues/1452>`_).
  380. For example, on macOS with clang the compile time of a test translation unit
  381. dropped from 2.3s to 0.3s with ``-O2`` and from 0.6s to 0.3s with the default
  382. settings (``-O0``).
  383. Before (``-O2``)::
  384. % time c++ -c test.cc -I include -std=c++17 -O2
  385. c++ -c test.cc -I include -std=c++17 -O2 2.22s user 0.08s system 99% cpu 2.311 total
  386. After (``-O2``)::
  387. % time c++ -c test.cc -I include -std=c++17 -O2
  388. c++ -c test.cc -I include -std=c++17 -O2 0.26s user 0.04s system 98% cpu 0.303 total
  389. Before (default)::
  390. % time c++ -c test.cc -I include -std=c++17
  391. c++ -c test.cc -I include -std=c++17 0.53s user 0.06s system 98% cpu 0.601 total
  392. After (default)::
  393. % time c++ -c test.cc -I include -std=c++17
  394. c++ -c test.cc -I include -std=c++17 0.24s user 0.06s system 98% cpu 0.301 total
  395. It is still recommended to use ``fmt/core.h`` instead of ``fmt/format.h`` but
  396. the compile time difference is now smaller. Thanks
  397. `@alex3d <https://github.com/alex3d>`_ for the suggestion.
  398. * Named arguments are now stored on stack (no dynamic memory allocations) and
  399. the compiled code is more compact and efficient. For example
  400. .. code:: c++
  401. #include <fmt/core.h>
  402. int main() {
  403. fmt::print("The answer is {answer}\n", fmt::arg("answer", 42));
  404. }
  405. compiles to just (`godbolt <https://godbolt.org/z/NcfEp_>`__)
  406. .. code:: asm
  407. .LC0:
  408. .string "answer"
  409. .LC1:
  410. .string "The answer is {answer}\n"
  411. main:
  412. sub rsp, 56
  413. mov edi, OFFSET FLAT:.LC1
  414. mov esi, 23
  415. movabs rdx, 4611686018427387905
  416. lea rax, [rsp+32]
  417. lea rcx, [rsp+16]
  418. mov QWORD PTR [rsp+8], 1
  419. mov QWORD PTR [rsp], rax
  420. mov DWORD PTR [rsp+16], 42
  421. mov QWORD PTR [rsp+32], OFFSET FLAT:.LC0
  422. mov DWORD PTR [rsp+40], 0
  423. call fmt::v6::vprint(fmt::v6::basic_string_view<char>,
  424. fmt::v6::format_args)
  425. xor eax, eax
  426. add rsp, 56
  427. ret
  428. .L.str.1:
  429. .asciz "answer"
  430. * Implemented compile-time checks for dynamic width and precision
  431. (`#1614 <https://github.com/fmtlib/fmt/issues/1614>`_):
  432. .. code:: c++
  433. #include <fmt/format.h>
  434. int main() {
  435. fmt::print(FMT_STRING("{0:{1}}"), 42);
  436. }
  437. now gives a compilation error because argument 1 doesn't exist::
  438. In file included from test.cc:1:
  439. include/fmt/format.h:2726:27: error: constexpr variable 'invalid_format' must be
  440. initialized by a constant expression
  441. FMT_CONSTEXPR_DECL bool invalid_format =
  442. ^
  443. ...
  444. include/fmt/core.h:569:26: note: in call to
  445. '&checker(s, {}).context_->on_error(&"argument not found"[0])'
  446. if (id >= num_args_) on_error("argument not found");
  447. ^
  448. * Added sentinel support to ``fmt::join``
  449. (`#1689 <https://github.com/fmtlib/fmt/pull/1689>`_)
  450. .. code:: c++
  451. struct zstring_sentinel {};
  452. bool operator==(const char* p, zstring_sentinel) { return *p == '\0'; }
  453. bool operator!=(const char* p, zstring_sentinel) { return *p != '\0'; }
  454. struct zstring {
  455. const char* p;
  456. const char* begin() const { return p; }
  457. zstring_sentinel end() const { return {}; }
  458. };
  459. auto s = fmt::format("{}", fmt::join(zstring{"hello"}, "_"));
  460. // s == "h_e_l_l_o"
  461. Thanks `@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.
  462. * Added support for named arguments, ``clear`` and ``reserve`` to
  463. ``dynamic_format_arg_store``
  464. (`#1655 <https://github.com/fmtlib/fmt/issues/1655>`_,
  465. `#1663 <https://github.com/fmtlib/fmt/pull/1663>`_,
  466. `#1674 <https://github.com/fmtlib/fmt/pull/1674>`_,
  467. `#1677 <https://github.com/fmtlib/fmt/pull/1677>`_).
  468. Thanks `@vsolontsov-ll (Vladimir Solontsov)
  469. <https://github.com/vsolontsov-ll>`_.
  470. * Added support for the ``'c'`` format specifier to integral types for
  471. compatibility with ``std::format``
  472. (`#1652 <https://github.com/fmtlib/fmt/issues/1652>`_).
  473. * Replaced the ``'n'`` format specifier with ``'L'`` for compatibility with
  474. ``std::format`` (`#1624 <https://github.com/fmtlib/fmt/issues/1624>`_).
  475. The ``'n'`` specifier can be enabled via the ``FMT_DEPRECATED_N_SPECIFIER``
  476. macro.
  477. * The ``'='`` format specifier is now disabled by default for compatibility with
  478. ``std::format``. It can be enabled via the ``FMT_DEPRECATED_NUMERIC_ALIGN``
  479. macro.
  480. * Removed the following deprecated APIs:
  481. * ``FMT_STRING_ALIAS`` and ``fmt`` macros - replaced by ``FMT_STRING``
  482. * ``fmt::basic_string_view::char_type`` - replaced by
  483. ``fmt::basic_string_view::value_type``
  484. * ``convert_to_int``
  485. * ``format_arg_store::types``
  486. * ``*parse_context`` - replaced by ``*format_parse_context``
  487. * ``FMT_DEPRECATED_INCLUDE_OS``
  488. * ``FMT_DEPRECATED_PERCENT`` - incompatible with ``std::format``
  489. * ``*writer`` - replaced by compiled format API
  490. * Renamed the ``internal`` namespace to ``detail``
  491. (`#1538 <https://github.com/fmtlib/fmt/issues/1538>`_). The former is still
  492. provided as an alias if the ``FMT_USE_INTERNAL`` macro is defined.
  493. * Improved compatibility between ``fmt::printf`` with the standard specs
  494. (`#1595 <https://github.com/fmtlib/fmt/issues/1595>`_,
  495. `#1682 <https://github.com/fmtlib/fmt/pull/1682>`_,
  496. `#1683 <https://github.com/fmtlib/fmt/pull/1683>`_,
  497. `#1687 <https://github.com/fmtlib/fmt/pull/1687>`_,
  498. `#1699 <https://github.com/fmtlib/fmt/pull/1699>`_).
  499. Thanks `@rimathia <https://github.com/rimathia>`_.
  500. * Fixed handling of ``operator<<`` overloads that use ``copyfmt``
  501. (`#1666 <https://github.com/fmtlib/fmt/issues/1666>`_).
  502. * Added the ``FMT_OS`` CMake option to control inclusion of OS-specific APIs
  503. in the fmt target. This can be useful for embedded platforms
  504. (`#1654 <https://github.com/fmtlib/fmt/issues/1654>`_,
  505. `#1656 <https://github.com/fmtlib/fmt/pull/1656>`_).
  506. Thanks `@kwesolowski (Krzysztof Wesolowski)
  507. <https://github.com/kwesolowski>`_.
  508. * Replaced ``FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION`` with the ``FMT_FUZZ``
  509. macro to prevent interferring with fuzzing of projects using {fmt}
  510. (`#1650 <https://github.com/fmtlib/fmt/pull/1650>`_).
  511. Thanks `@asraa (Asra Ali) <https://github.com/asraa>`_.
  512. * Fixed compatibility with emscripten
  513. (`#1636 <https://github.com/fmtlib/fmt/issues/1636>`_,
  514. `#1637 <https://github.com/fmtlib/fmt/pull/1637>`_).
  515. Thanks `@ArthurSonzogni (Arthur Sonzogni)
  516. <https://github.com/ArthurSonzogni>`_.
  517. * Improved documentation
  518. (`#704 <https://github.com/fmtlib/fmt/issues/704>`_,
  519. `#1643 <https://github.com/fmtlib/fmt/pull/1643>`_,
  520. `#1660 <https://github.com/fmtlib/fmt/pull/1660>`_,
  521. `#1681 <https://github.com/fmtlib/fmt/pull/1681>`_,
  522. `#1691 <https://github.com/fmtlib/fmt/pull/1691>`_,
  523. `#1706 <https://github.com/fmtlib/fmt/pull/1706>`_,
  524. `#1714 <https://github.com/fmtlib/fmt/pull/1714>`_,
  525. `#1721 <https://github.com/fmtlib/fmt/pull/1721>`_,
  526. `#1739 <https://github.com/fmtlib/fmt/pull/1739>`_,
  527. `#1740 <https://github.com/fmtlib/fmt/pull/1740>`_,
  528. `#1741 <https://github.com/fmtlib/fmt/pull/1741>`_,
  529. `#1751 <https://github.com/fmtlib/fmt/pull/1751>`_).
  530. Thanks `@senior7515 (Alexander Gallego) <https://github.com/senior7515>`_,
  531. `@lsr0 (Lindsay Roberts) <https://github.com/lsr0>`_,
  532. `@puetzk (Kevin Puetz) <https://github.com/puetzk>`_,
  533. `@fpelliccioni (Fernando Pelliccioni) <https://github.com/fpelliccioni>`_,
  534. Alexey Kuzmenko, `@jelly (jelle van der Waa) <https://github.com/jelly>`_,
  535. `@claremacrae (Clare Macrae) <https://github.com/claremacrae>`_,
  536. `@jiapengwen (文佳鹏) <https://github.com/jiapengwen>`_,
  537. `@gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>`_,
  538. `@alexey-milovidov <https://github.com/alexey-milovidov>`_.
  539. * Implemented various build configuration fixes and improvements
  540. (`#1603 <https://github.com/fmtlib/fmt/pull/1603>`_,
  541. `#1657 <https://github.com/fmtlib/fmt/pull/1657>`_,
  542. `#1702 <https://github.com/fmtlib/fmt/pull/1702>`_,
  543. `#1728 <https://github.com/fmtlib/fmt/pull/1728>`_).
  544. Thanks `@scramsby (Scott Ramsby) <https://github.com/scramsby>`_,
  545. `@jtojnar (Jan Tojnar) <https://github.com/jtojnar>`_,
  546. `@orivej (Orivej Desh) <https://github.com/orivej>`_,
  547. `@flagarde <https://github.com/flagarde>`_.
  548. * Fixed various warnings and compilation issues
  549. (`#1616 <https://github.com/fmtlib/fmt/pull/1616>`_,
  550. `#1620 <https://github.com/fmtlib/fmt/issues/1620>`_,
  551. `#1622 <https://github.com/fmtlib/fmt/issues/1622>`_,
  552. `#1625 <https://github.com/fmtlib/fmt/issues/1625>`_,
  553. `#1627 <https://github.com/fmtlib/fmt/pull/1627>`_,
  554. `#1628 <https://github.com/fmtlib/fmt/issues/1628>`_,
  555. `#1629 <https://github.com/fmtlib/fmt/pull/1629>`_,
  556. `#1631 <https://github.com/fmtlib/fmt/issues/1631>`_,
  557. `#1633 <https://github.com/fmtlib/fmt/pull/1633>`_,
  558. `#1649 <https://github.com/fmtlib/fmt/pull/1649>`_,
  559. `#1658 <https://github.com/fmtlib/fmt/issues/1658>`_,
  560. `#1661 <https://github.com/fmtlib/fmt/pull/1661>`_,
  561. `#1667 <https://github.com/fmtlib/fmt/pull/1667>`_,
  562. `#1668 <https://github.com/fmtlib/fmt/issues/1668>`_,
  563. `#1669 <https://github.com/fmtlib/fmt/pull/1669>`_,
  564. `#1692 <https://github.com/fmtlib/fmt/issues/1692>`_,
  565. `#1696 <https://github.com/fmtlib/fmt/pull/1696>`_,
  566. `#1697 <https://github.com/fmtlib/fmt/pull/1697>`_,
  567. `#1707 <https://github.com/fmtlib/fmt/issues/1707>`_,
  568. `#1712 <https://github.com/fmtlib/fmt/pull/1712>`_,
  569. `#1716 <https://github.com/fmtlib/fmt/pull/1716>`_,
  570. `#1722 <https://github.com/fmtlib/fmt/pull/1722>`_,
  571. `#1724 <https://github.com/fmtlib/fmt/issues/1724>`_,
  572. `#1729 <https://github.com/fmtlib/fmt/pull/1729>`_,
  573. `#1738 <https://github.com/fmtlib/fmt/pull/1738>`_,
  574. `#1742 <https://github.com/fmtlib/fmt/issues/1742>`_,
  575. `#1743 <https://github.com/fmtlib/fmt/issues/1743>`_,
  576. `#1744 <https://github.com/fmtlib/fmt/pull/1744>`_,
  577. `#1747 <https://github.com/fmtlib/fmt/issues/1747>`_,
  578. `#1750 <https://github.com/fmtlib/fmt/pull/1750>`_).
  579. Thanks `@gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>`_,
  580. `@gabime (Gabi Melman) <https://github.com/gabime>`_,
  581. `@johnor (Johan) <https://github.com/johnor>`_,
  582. `@Kurkin (Dmitry Kurkin) <https://github.com/Kurkin>`_,
  583. `@invexed (James Beach) <https://github.com/invexed>`_,
  584. `@peterbell10 <https://github.com/peterbell10>`_,
  585. `@daixtrose (Markus Werle) <https://github.com/daixtrose>`_,
  586. `@petrutlucian94 (Lucian Petrut) <https://github.com/petrutlucian94>`_,
  587. `@Neargye (Daniil Goncharov) <https://github.com/Neargye>`_,
  588. `@ambitslix (Attila M. Szilagyi) <https://github.com/ambitslix>`_,
  589. `@gabime (Gabi Melman) <https://github.com/gabime>`_,
  590. `@erthink (Leonid Yuriev) <https://github.com/erthink>`_,
  591. `@tohammer (Tobias Hammer) <https://github.com/tohammer>`_,
  592. `@0x8000-0000 (Florin Iucha) <https://github.com/0x8000-0000>`_.
  593. 6.2.1 - 2020-05-09
  594. ------------------
  595. * Fixed ostream support in ``sprintf``
  596. (`#1631 <https://github.com/fmtlib/fmt/issues/1631>`_).
  597. * Fixed type detection when using implicit conversion to ``string_view`` and
  598. ostream ``operator<<`` inconsistently
  599. (`#1662 <https://github.com/fmtlib/fmt/issues/1662>`_).
  600. 6.2.0 - 2020-04-05
  601. ------------------
  602. * Improved error reporting when trying to format an object of a non-formattable
  603. type:
  604. .. code:: c++
  605. fmt::format("{}", S());
  606. now gives::
  607. include/fmt/core.h:1015:5: error: static_assert failed due to requirement
  608. 'formattable' "Cannot format argument. To make type T formattable provide a
  609. formatter<T> specialization:
  610. https://fmt.dev/latest/api.html#formatting-user-defined-types"
  611. static_assert(
  612. ^
  613. ...
  614. note: in instantiation of function template specialization
  615. 'fmt::v6::format<char [3], S, char>' requested here
  616. fmt::format("{}", S());
  617. ^
  618. if ``S`` is not formattable.
  619. * Reduced the library size by ~10%.
  620. * Always print decimal point if ``#`` is specified
  621. (`#1476 <https://github.com/fmtlib/fmt/issues/1476>`_,
  622. `#1498 <https://github.com/fmtlib/fmt/issues/1498>`_):
  623. .. code:: c++
  624. fmt::print("{:#.0f}", 42.0);
  625. now prints ``42.``
  626. * Implemented the ``'L'`` specifier for locale-specific numeric formatting to
  627. improve compatibility with ``std::format``. The ``'n'`` specifier is now
  628. deprecated and will be removed in the next major release.
  629. * Moved OS-specific APIs such as ``windows_error`` from ``fmt/format.h`` to
  630. ``fmt/os.h``. You can define ``FMT_DEPRECATED_INCLUDE_OS`` to automatically
  631. include ``fmt/os.h`` from ``fmt/format.h`` for compatibility but this will be
  632. disabled in the next major release.
  633. * Added precision overflow detection in floating-point formatting.
  634. * Implemented detection of invalid use of ``fmt::arg``.
  635. * Used ``type_identity`` to block unnecessary template argument deduction.
  636. Thanks Tim Song.
  637. * Improved UTF-8 handling
  638. (`#1109 <https://github.com/fmtlib/fmt/issues/1109>`_):
  639. .. code:: c++
  640. fmt::print("┌{0:─^{2}}┐\n"
  641. "│{1: ^{2}}│\n"
  642. "└{0:─^{2}}┘\n", "", "Привет, мир!", 20);
  643. now prints::
  644. ┌────────────────────┐
  645. │ Привет, мир! │
  646. └────────────────────┘
  647. on systems that support Unicode.
  648. * Added experimental dynamic argument storage
  649. (`#1170 <https://github.com/fmtlib/fmt/issues/1170>`_,
  650. `#1584 <https://github.com/fmtlib/fmt/pull/1584>`_):
  651. .. code:: c++
  652. fmt::dynamic_format_arg_store<fmt::format_context> store;
  653. store.push_back("answer");
  654. store.push_back(42);
  655. fmt::vprint("The {} is {}.\n", store);
  656. prints::
  657. The answer is 42.
  658. Thanks `@vsolontsov-ll (Vladimir Solontsov)
  659. <https://github.com/vsolontsov-ll>`_.
  660. * Made ``fmt::join`` accept ``initializer_list``
  661. (`#1591 <https://github.com/fmtlib/fmt/pull/1591>`_).
  662. Thanks `@Rapotkinnik (Nikolay Rapotkin) <https://github.com/Rapotkinnik>`_.
  663. * Fixed handling of empty tuples
  664. (`#1588 <https://github.com/fmtlib/fmt/issues/1588>`_).
  665. * Fixed handling of output iterators in ``format_to_n``
  666. (`#1506 <https://github.com/fmtlib/fmt/issues/1506>`_).
  667. * Fixed formatting of ``std::chrono::duration`` types to wide output
  668. (`#1533 <https://github.com/fmtlib/fmt/pull/1533>`_).
  669. Thanks `@zeffy (pilao) <https://github.com/zeffy>`_.
  670. * Added const ``begin`` and ``end`` overload to buffers
  671. (`#1553 <https://github.com/fmtlib/fmt/pull/1553>`_).
  672. Thanks `@dominicpoeschko <https://github.com/dominicpoeschko>`_.
  673. * Added the ability to disable floating-point formatting via ``FMT_USE_FLOAT``,
  674. ``FMT_USE_DOUBLE`` and ``FMT_USE_LONG_DOUBLE`` macros for extremely
  675. memory-constrained embedded system
  676. (`#1590 <https://github.com/fmtlib/fmt/pull/1590>`_).
  677. Thanks `@albaguirre (Alberto Aguirre) <https://github.com/albaguirre>`_.
  678. * Made ``FMT_STRING`` work with ``constexpr`` ``string_view``
  679. (`#1589 <https://github.com/fmtlib/fmt/pull/1589>`_).
  680. Thanks `@scramsby (Scott Ramsby) <https://github.com/scramsby>`_.
  681. * Implemented a minor optimization in the format string parser
  682. (`#1560 <https://github.com/fmtlib/fmt/pull/1560>`_).
  683. Thanks `@IkarusDeveloper <https://github.com/IkarusDeveloper>`_.
  684. * Improved attribute detection
  685. (`#1469 <https://github.com/fmtlib/fmt/pull/1469>`_,
  686. `#1475 <https://github.com/fmtlib/fmt/pull/1475>`_,
  687. `#1576 <https://github.com/fmtlib/fmt/pull/1576>`_).
  688. Thanks `@federico-busato (Federico) <https://github.com/federico-busato>`_,
  689. `@chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>`_,
  690. `@refnum <https://github.com/refnum>`_.
  691. * Improved documentation
  692. (`#1481 <https://github.com/fmtlib/fmt/pull/1481>`_,
  693. `#1523 <https://github.com/fmtlib/fmt/pull/1523>`_).
  694. Thanks `@JackBoosY (Jack·Boos·Yu) <https://github.com/JackBoosY>`_,
  695. `@imba-tjd (谭九鼎) <https://github.com/imba-tjd>`_.
  696. * Fixed symbol visibility on Linux when compiling with ``-fvisibility=hidden``
  697. (`#1535 <https://github.com/fmtlib/fmt/pull/1535>`_).
  698. Thanks `@milianw (Milian Wolff) <https://github.com/milianw>`_.
  699. * Implemented various build configuration fixes and improvements
  700. (`#1264 <https://github.com/fmtlib/fmt/issues/1264>`_,
  701. `#1460 <https://github.com/fmtlib/fmt/issues/1460>`_,
  702. `#1534 <https://github.com/fmtlib/fmt/pull/1534>`_,
  703. `#1536 <https://github.com/fmtlib/fmt/issues/1536>`_,
  704. `#1545 <https://github.com/fmtlib/fmt/issues/1545>`_,
  705. `#1546 <https://github.com/fmtlib/fmt/pull/1546>`_,
  706. `#1566 <https://github.com/fmtlib/fmt/issues/1566>`_,
  707. `#1582 <https://github.com/fmtlib/fmt/pull/1582>`_,
  708. `#1597 <https://github.com/fmtlib/fmt/issues/1597>`_,
  709. `#1598 <https://github.com/fmtlib/fmt/pull/1598>`_).
  710. Thanks `@ambitslix (Attila M. Szilagyi) <https://github.com/ambitslix>`_,
  711. `@jwillikers (Jordan Williams) <https://github.com/jwillikers>`_,
  712. `@stac47 (Laurent Stacul) <https://github.com/stac47>`_.
  713. * Fixed various warnings and compilation issues
  714. (`#1433 <https://github.com/fmtlib/fmt/pull/1433>`_,
  715. `#1461 <https://github.com/fmtlib/fmt/issues/1461>`_,
  716. `#1470 <https://github.com/fmtlib/fmt/pull/1470>`_,
  717. `#1480 <https://github.com/fmtlib/fmt/pull/1480>`_,
  718. `#1485 <https://github.com/fmtlib/fmt/pull/1485>`_,
  719. `#1492 <https://github.com/fmtlib/fmt/pull/1492>`_,
  720. `#1493 <https://github.com/fmtlib/fmt/issues/1493>`_,
  721. `#1504 <https://github.com/fmtlib/fmt/issues/1504>`_,
  722. `#1505 <https://github.com/fmtlib/fmt/pull/1505>`_,
  723. `#1512 <https://github.com/fmtlib/fmt/pull/1512>`_,
  724. `#1515 <https://github.com/fmtlib/fmt/issues/1515>`_,
  725. `#1516 <https://github.com/fmtlib/fmt/pull/1516>`_,
  726. `#1518 <https://github.com/fmtlib/fmt/pull/1518>`_,
  727. `#1519 <https://github.com/fmtlib/fmt/pull/1519>`_,
  728. `#1520 <https://github.com/fmtlib/fmt/pull/1520>`_,
  729. `#1521 <https://github.com/fmtlib/fmt/pull/1521>`_,
  730. `#1522 <https://github.com/fmtlib/fmt/pull/1522>`_,
  731. `#1524 <https://github.com/fmtlib/fmt/issues/1524>`_,
  732. `#1530 <https://github.com/fmtlib/fmt/pull/1530>`_,
  733. `#1531 <https://github.com/fmtlib/fmt/issues/1531>`_,
  734. `#1532 <https://github.com/fmtlib/fmt/pull/1532>`_,
  735. `#1539 <https://github.com/fmtlib/fmt/issues/1539>`_,
  736. `#1547 <https://github.com/fmtlib/fmt/issues/1547>`_,
  737. `#1548 <https://github.com/fmtlib/fmt/issues/1548>`_,
  738. `#1554 <https://github.com/fmtlib/fmt/pull/1554>`_,
  739. `#1567 <https://github.com/fmtlib/fmt/issues/1567>`_,
  740. `#1568 <https://github.com/fmtlib/fmt/pull/1568>`_,
  741. `#1569 <https://github.com/fmtlib/fmt/pull/1569>`_,
  742. `#1571 <https://github.com/fmtlib/fmt/pull/1571>`_,
  743. `#1573 <https://github.com/fmtlib/fmt/pull/1573>`_,
  744. `#1575 <https://github.com/fmtlib/fmt/pull/1575>`_,
  745. `#1581 <https://github.com/fmtlib/fmt/pull/1581>`_,
  746. `#1583 <https://github.com/fmtlib/fmt/issues/1583>`_,
  747. `#1586 <https://github.com/fmtlib/fmt/issues/1586>`_,
  748. `#1587 <https://github.com/fmtlib/fmt/issues/1587>`_,
  749. `#1594 <https://github.com/fmtlib/fmt/issues/1594>`_,
  750. `#1596 <https://github.com/fmtlib/fmt/pull/1596>`_,
  751. `#1604 <https://github.com/fmtlib/fmt/issues/1604>`_,
  752. `#1606 <https://github.com/fmtlib/fmt/pull/1606>`_,
  753. `#1607 <https://github.com/fmtlib/fmt/issues/1607>`_,
  754. `#1609 <https://github.com/fmtlib/fmt/issues/1609>`_).
  755. Thanks `@marti4d (Chris Martin) <https://github.com/marti4d>`_,
  756. `@iPherian <https://github.com/iPherian>`_,
  757. `@parkertomatoes <https://github.com/parkertomatoes>`_,
  758. `@gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>`_,
  759. `@chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>`_,
  760. `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_,
  761. `@torsten48 <https://github.com/torsten48>`_,
  762. `@tohammer (Tobias Hammer) <https://github.com/tohammer>`_,
  763. `@lefticus (Jason Turner) <https://github.com/lefticus>`_,
  764. `@ryusakki (Haise) <https://github.com/ryusakki>`_,
  765. `@adnsv (Alex Denisov) <https://github.com/adnsv>`_,
  766. `@fghzxm <https://github.com/fghzxm>`_,
  767. `@refnum <https://github.com/refnum>`_,
  768. `@pramodk (Pramod Kumbhar) <https://github.com/pramodk>`_,
  769. `@Spirrwell <https://github.com/Spirrwell>`_,
  770. `@scramsby (Scott Ramsby) <https://github.com/scramsby>`_.
  771. 6.1.2 - 2019-12-11
  772. ------------------
  773. * Fixed ABI compatibility with ``libfmt.so.6.0.0``
  774. (`#1471 <https://github.com/fmtlib/fmt/issues/1471>`_).
  775. * Fixed handling types convertible to ``std::string_view``
  776. (`#1451 <https://github.com/fmtlib/fmt/pull/1451>`_).
  777. Thanks `@denizevrenci (Deniz Evrenci) <https://github.com/denizevrenci>`_.
  778. * Made CUDA test an opt-in enabled via the ``FMT_CUDA_TEST`` CMake option.
  779. * Fixed sign conversion warnings
  780. (`#1440 <https://github.com/fmtlib/fmt/pull/1440>`_).
  781. Thanks `@0x8000-0000 (Florin Iucha) <https://github.com/0x8000-0000>`_.
  782. 6.1.1 - 2019-12-04
  783. ------------------
  784. * Fixed shared library build on Windows
  785. (`#1443 <https://github.com/fmtlib/fmt/pull/1443>`_,
  786. `#1445 <https://github.com/fmtlib/fmt/issues/1445>`_,
  787. `#1446 <https://github.com/fmtlib/fmt/pull/1446>`_,
  788. `#1450 <https://github.com/fmtlib/fmt/issues/1450>`_).
  789. Thanks `@egorpugin (Egor Pugin) <https://github.com/egorpugin>`_,
  790. `@bbolli (Beat Bolli) <https://github.com/bbolli>`_.
  791. * Added a missing decimal point in exponent notation with trailing zeros.
  792. * Removed deprecated ``format_arg_store::TYPES``.
  793. 6.1.0 - 2019-12-01
  794. ------------------
  795. * {fmt} now formats IEEE 754 ``float`` and ``double`` using the shortest decimal
  796. representation with correct rounding by default:
  797. .. code:: c++
  798. #include <cmath>
  799. #include <fmt/core.h>
  800. int main() {
  801. fmt::print("{}", M_PI);
  802. }
  803. prints ``3.141592653589793``.
  804. * Made the fast binary to decimal floating-point formatter the default,
  805. simplified it and improved performance. {fmt} is now 15 times faster than
  806. libc++'s ``std::ostringstream``, 11 times faster than ``printf`` and 10%
  807. faster than double-conversion on `dtoa-benchmark
  808. <https://github.com/fmtlib/dtoa-benchmark>`_:
  809. ================== ========= =======
  810. Function Time (ns) Speedup
  811. ================== ========= =======
  812. ostringstream 1,346.30 1.00x
  813. ostrstream 1,195.74 1.13x
  814. sprintf 995.08 1.35x
  815. doubleconv 99.10 13.59x
  816. fmt 88.34 15.24x
  817. ================== ========= =======
  818. .. image:: https://user-images.githubusercontent.com/576385/
  819. 69767160-cdaca400-112f-11ea-9fc5-347c9f83caad.png
  820. * {fmt} no longer converts ``float`` arguments to ``double``. In particular this
  821. improves the default (shortest) representation of floats and makes
  822. ``fmt::format`` consistent with ``std::format`` specs
  823. (`#1336 <https://github.com/fmtlib/fmt/issues/1336>`_,
  824. `#1353 <https://github.com/fmtlib/fmt/issues/1353>`_,
  825. `#1360 <https://github.com/fmtlib/fmt/pull/1360>`_,
  826. `#1361 <https://github.com/fmtlib/fmt/pull/1361>`_):
  827. .. code:: c++
  828. fmt::print("{}", 0.1f);
  829. prints ``0.1`` instead of ``0.10000000149011612``.
  830. Thanks `@orivej (Orivej Desh) <https://github.com/orivej>`_.
  831. * Made floating-point formatting output consistent with ``printf``/iostreams
  832. (`#1376 <https://github.com/fmtlib/fmt/issues/1376>`_,
  833. `#1417 <https://github.com/fmtlib/fmt/issues/1417>`_).
  834. * Added support for 128-bit integers
  835. (`#1287 <https://github.com/fmtlib/fmt/pull/1287>`_):
  836. .. code:: c++
  837. fmt::print("{}", std::numeric_limits<__int128_t>::max());
  838. prints ``170141183460469231731687303715884105727``.
  839. Thanks `@denizevrenci (Deniz Evrenci) <https://github.com/denizevrenci>`_.
  840. * The overload of ``print`` that takes ``text_style`` is now atomic, i.e. the
  841. output from different threads doesn't interleave
  842. (`#1351 <https://github.com/fmtlib/fmt/pull/1351>`_).
  843. Thanks `@tankiJong (Tanki Zhang) <https://github.com/tankiJong>`_.
  844. * Made compile time in the header-only mode ~20% faster by reducing the number
  845. of template instantiations. ``wchar_t`` overload of ``vprint`` was moved from
  846. ``fmt/core.h`` to ``fmt/format.h``.
  847. * Added an overload of ``fmt::join`` that works with tuples
  848. (`#1322 <https://github.com/fmtlib/fmt/issues/1322>`_,
  849. `#1330 <https://github.com/fmtlib/fmt/pull/1330>`_):
  850. .. code:: c++
  851. #include <tuple>
  852. #include <fmt/ranges.h>
  853. int main() {
  854. std::tuple<char, int, float> t{'a', 1, 2.0f};
  855. fmt::print("{}", t);
  856. }
  857. prints ``('a', 1, 2.0)``.
  858. Thanks `@jeremyong (Jeremy Ong) <https://github.com/jeremyong>`_.
  859. * Changed formatting of octal zero with prefix from "00" to "0":
  860. .. code:: c++
  861. fmt::print("{:#o}", 0);
  862. prints ``0``.
  863. * The locale is now passed to ostream insertion (``<<``) operators
  864. (`#1406 <https://github.com/fmtlib/fmt/pull/1406>`_):
  865. .. code:: c++
  866. #include <fmt/locale.h>
  867. #include <fmt/ostream.h>
  868. struct S {
  869. double value;
  870. };
  871. std::ostream& operator<<(std::ostream& os, S s) {
  872. return os << s.value;
  873. }
  874. int main() {
  875. auto s = fmt::format(std::locale("fr_FR.UTF-8"), "{}", S{0.42});
  876. // s == "0,42"
  877. }
  878. Thanks `@dlaugt (Daniel Laügt) <https://github.com/dlaugt>`_.
  879. * Locale-specific number formatting now uses grouping
  880. (`#1393 <https://github.com/fmtlib/fmt/issues/1393>`_
  881. `#1394 <https://github.com/fmtlib/fmt/pull/1394>`_).
  882. Thanks `@skrdaniel <https://github.com/skrdaniel>`_.
  883. * Fixed handling of types with deleted implicit rvalue conversion to
  884. ``const char**`` (`#1421 <https://github.com/fmtlib/fmt/issues/1421>`_):
  885. .. code:: c++
  886. struct mystring {
  887. operator const char*() const&;
  888. operator const char*() &;
  889. operator const char*() const&& = delete;
  890. operator const char*() && = delete;
  891. };
  892. mystring str;
  893. fmt::print("{}", str); // now compiles
  894. * Enums are now mapped to correct underlying types instead of ``int``
  895. (`#1286 <https://github.com/fmtlib/fmt/pull/1286>`_).
  896. Thanks `@agmt (Egor Seredin) <https://github.com/agmt>`_.
  897. * Enum classes are no longer implicitly converted to ``int``
  898. (`#1424 <https://github.com/fmtlib/fmt/issues/1424>`_).
  899. * Added ``basic_format_parse_context`` for consistency with C++20
  900. ``std::format`` and deprecated ``basic_parse_context``.
  901. * Fixed handling of UTF-8 in precision
  902. (`#1389 <https://github.com/fmtlib/fmt/issues/1389>`_,
  903. `#1390 <https://github.com/fmtlib/fmt/pull/1390>`_).
  904. Thanks `@tajtiattila (Attila Tajti) <https://github.com/tajtiattila>`_.
  905. * {fmt} can now be installed on Linux, macOS and Windows with
  906. `Conda <https://docs.conda.io/en/latest/>`__ using its
  907. `conda-forge <https://conda-forge.org>`__
  908. `package <https://github.com/conda-forge/fmt-feedstock>`__
  909. (`#1410 <https://github.com/fmtlib/fmt/pull/1410>`_)::
  910. conda install -c conda-forge fmt
  911. Thanks `@tdegeus (Tom de Geus) <https://github.com/tdegeus>`_.
  912. * Added a CUDA test (`#1285 <https://github.com/fmtlib/fmt/pull/1285>`_,
  913. `#1317 <https://github.com/fmtlib/fmt/pull/1317>`_).
  914. Thanks `@luncliff (Park DongHa) <https://github.com/luncliff>`_ and
  915. `@risa2000 <https://github.com/risa2000>`_.
  916. * Improved documentation (`#1276 <https://github.com/fmtlib/fmt/pull/1276>`_,
  917. `#1291 <https://github.com/fmtlib/fmt/issues/1291>`_,
  918. `#1296 <https://github.com/fmtlib/fmt/issues/1296>`_,
  919. `#1315 <https://github.com/fmtlib/fmt/pull/1315>`_,
  920. `#1332 <https://github.com/fmtlib/fmt/pull/1332>`_,
  921. `#1337 <https://github.com/fmtlib/fmt/pull/1337>`_,
  922. `#1395 <https://github.com/fmtlib/fmt/issues/1395>`_
  923. `#1418 <https://github.com/fmtlib/fmt/pull/1418>`_).
  924. Thanks
  925. `@waywardmonkeys (Bruce Mitchener) <https://github.com/waywardmonkeys>`_,
  926. `@pauldreik (Paul Dreik) <https://github.com/pauldreik>`_,
  927. `@jackoalan (Jack Andersen) <https://github.com/jackoalan>`_.
  928. * Various code improvements
  929. (`#1358 <https://github.com/fmtlib/fmt/pull/1358>`_,
  930. `#1407 <https://github.com/fmtlib/fmt/pull/1407>`_).
  931. Thanks `@orivej (Orivej Desh) <https://github.com/orivej>`_,
  932. `@dpacbach (David P. Sicilia) <https://github.com/dpacbach>`_,
  933. * Fixed compile-time format string checks for user-defined types
  934. (`#1292 <https://github.com/fmtlib/fmt/issues/1292>`_).
  935. * Worked around a false positive in ``unsigned-integer-overflow`` sanitizer
  936. (`#1377 <https://github.com/fmtlib/fmt/issues/1377>`_).
  937. * Fixed various warnings and compilation issues
  938. (`#1273 <https://github.com/fmtlib/fmt/issues/1273>`_,
  939. `#1278 <https://github.com/fmtlib/fmt/pull/1278>`_,
  940. `#1280 <https://github.com/fmtlib/fmt/pull/1280>`_,
  941. `#1281 <https://github.com/fmtlib/fmt/issues/1281>`_,
  942. `#1288 <https://github.com/fmtlib/fmt/issues/1288>`_,
  943. `#1290 <https://github.com/fmtlib/fmt/pull/1290>`_,
  944. `#1301 <https://github.com/fmtlib/fmt/pull/1301>`_,
  945. `#1305 <https://github.com/fmtlib/fmt/issues/1305>`_,
  946. `#1306 <https://github.com/fmtlib/fmt/issues/1306>`_,
  947. `#1309 <https://github.com/fmtlib/fmt/issues/1309>`_,
  948. `#1312 <https://github.com/fmtlib/fmt/pull/1312>`_,
  949. `#1313 <https://github.com/fmtlib/fmt/issues/1313>`_,
  950. `#1316 <https://github.com/fmtlib/fmt/issues/1316>`_,
  951. `#1319 <https://github.com/fmtlib/fmt/issues/1319>`_,
  952. `#1320 <https://github.com/fmtlib/fmt/pull/1320>`_,
  953. `#1326 <https://github.com/fmtlib/fmt/pull/1326>`_,
  954. `#1328 <https://github.com/fmtlib/fmt/pull/1328>`_,
  955. `#1344 <https://github.com/fmtlib/fmt/issues/1344>`_,
  956. `#1345 <https://github.com/fmtlib/fmt/pull/1345>`_,
  957. `#1347 <https://github.com/fmtlib/fmt/pull/1347>`_,
  958. `#1349 <https://github.com/fmtlib/fmt/pull/1349>`_,
  959. `#1354 <https://github.com/fmtlib/fmt/issues/1354>`_,
  960. `#1362 <https://github.com/fmtlib/fmt/issues/1362>`_,
  961. `#1366 <https://github.com/fmtlib/fmt/issues/1366>`_,
  962. `#1364 <https://github.com/fmtlib/fmt/pull/1364>`_,
  963. `#1370 <https://github.com/fmtlib/fmt/pull/1370>`_,
  964. `#1371 <https://github.com/fmtlib/fmt/pull/1371>`_,
  965. `#1385 <https://github.com/fmtlib/fmt/issues/1385>`_,
  966. `#1388 <https://github.com/fmtlib/fmt/issues/1388>`_,
  967. `#1397 <https://github.com/fmtlib/fmt/pull/1397>`_,
  968. `#1414 <https://github.com/fmtlib/fmt/pull/1414>`_,
  969. `#1416 <https://github.com/fmtlib/fmt/pull/1416>`_,
  970. `#1422 <https://github.com/fmtlib/fmt/issues/1422>`_
  971. `#1427 <https://github.com/fmtlib/fmt/pull/1427>`_,
  972. `#1431 <https://github.com/fmtlib/fmt/issues/1431>`_,
  973. `#1433 <https://github.com/fmtlib/fmt/pull/1433>`_).
  974. Thanks `@hhb <https://github.com/hhb>`_,
  975. `@gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>`_,
  976. `@gabime (Gabi Melman) <https://github.com/gabime>`_,
  977. `@neheb (Rosen Penev) <https://github.com/neheb>`_,
  978. `@vedranmiletic (Vedran Miletić) <https://github.com/vedranmiletic>`_,
  979. `@dkavolis (Daumantas Kavolis) <https://github.com/dkavolis>`_,
  980. `@mwinterb <https://github.com/mwinterb>`_,
  981. `@orivej (Orivej Desh) <https://github.com/orivej>`_,
  982. `@denizevrenci (Deniz Evrenci) <https://github.com/denizevrenci>`_
  983. `@leonklingele <https://github.com/leonklingele>`_,
  984. `@chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>`_,
  985. `@kent-tri <https://github.com/kent-tri>`_,
  986. `@0x8000-0000 (Florin Iucha) <https://github.com/0x8000-0000>`_,
  987. `@marti4d (Chris Martin) <https://github.com/marti4d>`_.
  988. 6.0.0 - 2019-08-26
  989. ------------------
  990. * Switched to the `MIT license
  991. <https://github.com/fmtlib/fmt/blob/5a4b24613ba16cc689977c3b5bd8274a3ba1dd1f/LICENSE.rst>`_
  992. with an optional exception that allows distributing binary code without
  993. attribution.
  994. * Floating-point formatting is now locale-independent by default:
  995. .. code:: c++
  996. #include <locale>
  997. #include <fmt/core.h>
  998. int main() {
  999. std::locale::global(std::locale("ru_RU.UTF-8"));
  1000. fmt::print("value = {}", 4.2);
  1001. }
  1002. prints "value = 4.2" regardless of the locale.
  1003. For locale-specific formatting use the ``n`` specifier:
  1004. .. code:: c++
  1005. std::locale::global(std::locale("ru_RU.UTF-8"));
  1006. fmt::print("value = {:n}", 4.2);
  1007. prints "value = 4,2".
  1008. * Added an experimental Grisu floating-point formatting algorithm
  1009. implementation (disabled by default). To enable it compile with the
  1010. ``FMT_USE_GRISU`` macro defined to 1:
  1011. .. code:: c++
  1012. #define FMT_USE_GRISU 1
  1013. #include <fmt/format.h>
  1014. auto s = fmt::format("{}", 4.2); // formats 4.2 using Grisu
  1015. With Grisu enabled, {fmt} is 13x faster than ``std::ostringstream`` (libc++)
  1016. and 10x faster than ``sprintf`` on `dtoa-benchmark
  1017. <https://github.com/fmtlib/dtoa-benchmark>`_ (`full results
  1018. <https://fmt.dev/unknown_mac64_clang10.0.html>`_):
  1019. .. image:: https://user-images.githubusercontent.com/576385/
  1020. 54883977-9fe8c000-4e28-11e9-8bde-272d122e7c52.jpg
  1021. * Separated formatting and parsing contexts for consistency with
  1022. `C++20 std::format <http://eel.is/c++draft/format>`_, removing the
  1023. undocumented ``basic_format_context::parse_context()`` function.
  1024. * Added `oss-fuzz <https://github.com/google/oss-fuzz>`_ support
  1025. (`#1199 <https://github.com/fmtlib/fmt/pull/1199>`_).
  1026. Thanks `@pauldreik (Paul Dreik) <https://github.com/pauldreik>`_.
  1027. * ``formatter`` specializations now always take precedence over ``operator<<``
  1028. (`#952 <https://github.com/fmtlib/fmt/issues/952>`_):
  1029. .. code:: c++
  1030. #include <iostream>
  1031. #include <fmt/ostream.h>
  1032. struct S {};
  1033. std::ostream& operator<<(std::ostream& os, S) {
  1034. return os << 1;
  1035. }
  1036. template <>
  1037. struct fmt::formatter<S> : fmt::formatter<int> {
  1038. auto format(S, format_context& ctx) {
  1039. return formatter<int>::format(2, ctx);
  1040. }
  1041. };
  1042. int main() {
  1043. std::cout << S() << "\n"; // prints 1 using operator<<
  1044. fmt::print("{}\n", S()); // prints 2 using formatter
  1045. }
  1046. * Introduced the experimental ``fmt::compile`` function that does format string
  1047. compilation (`#618 <https://github.com/fmtlib/fmt/issues/618>`_,
  1048. `#1169 <https://github.com/fmtlib/fmt/issues/1169>`_,
  1049. `#1171 <https://github.com/fmtlib/fmt/pull/1171>`_):
  1050. .. code:: c++
  1051. #include <fmt/compile.h>
  1052. auto f = fmt::compile<int>("{}");
  1053. std::string s = fmt::format(f, 42); // can be called multiple times to
  1054. // format different values
  1055. // s == "42"
  1056. It moves the cost of parsing a format string outside of the format function
  1057. which can be beneficial when identically formatting many objects of the same
  1058. types. Thanks `@stryku (Mateusz Janek) <https://github.com/stryku>`_.
  1059. * Added experimental ``%`` format specifier that formats floating-point values
  1060. as percentages (`#1060 <https://github.com/fmtlib/fmt/pull/1060>`_,
  1061. `#1069 <https://github.com/fmtlib/fmt/pull/1069>`_,
  1062. `#1071 <https://github.com/fmtlib/fmt/pull/1071>`_):
  1063. .. code:: c++
  1064. auto s = fmt::format("{:.1%}", 0.42); // s == "42.0%"
  1065. Thanks `@gawain-bolton (Gawain Bolton) <https://github.com/gawain-bolton>`_.
  1066. * Implemented precision for floating-point durations
  1067. (`#1004 <https://github.com/fmtlib/fmt/issues/1004>`_,
  1068. `#1012 <https://github.com/fmtlib/fmt/pull/1012>`_):
  1069. .. code:: c++
  1070. auto s = fmt::format("{:.1}", std::chrono::duration<double>(1.234));
  1071. // s == 1.2s
  1072. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1073. * Implemented ``chrono`` format specifiers ``%Q`` and ``%q`` that give the value
  1074. and the unit respectively (`#1019 <https://github.com/fmtlib/fmt/pull/1019>`_):
  1075. .. code:: c++
  1076. auto value = fmt::format("{:%Q}", 42s); // value == "42"
  1077. auto unit = fmt::format("{:%q}", 42s); // unit == "s"
  1078. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1079. * Fixed handling of dynamic width in chrono formatter:
  1080. .. code:: c++
  1081. auto s = fmt::format("{0:{1}%H:%M:%S}", std::chrono::seconds(12345), 12);
  1082. // ^ width argument index ^ width
  1083. // s == "03:25:45 "
  1084. Thanks Howard Hinnant.
  1085. * Removed deprecated ``fmt/time.h``. Use ``fmt/chrono.h`` instead.
  1086. * Added ``fmt::format`` and ``fmt::vformat`` overloads that take ``text_style``
  1087. (`#993 <https://github.com/fmtlib/fmt/issues/993>`_,
  1088. `#994 <https://github.com/fmtlib/fmt/pull/994>`_):
  1089. .. code:: c++
  1090. #include <fmt/color.h>
  1091. std::string message = fmt::format(fmt::emphasis::bold | fg(fmt::color::red),
  1092. "The answer is {}.", 42);
  1093. Thanks `@Naios (Denis Blank) <https://github.com/Naios>`_.
  1094. * Removed the deprecated color API (``print_colored``). Use the new API, namely
  1095. ``print`` overloads that take ``text_style`` instead.
  1096. * Made ``std::unique_ptr`` and ``std::shared_ptr`` formattable as pointers via
  1097. ``fmt::ptr`` (`#1121 <https://github.com/fmtlib/fmt/pull/1121>`_):
  1098. .. code:: c++
  1099. std::unique_ptr<int> p = ...;
  1100. fmt::print("{}", fmt::ptr(p)); // prints p as a pointer
  1101. Thanks `@sighingnow (Tao He) <https://github.com/sighingnow>`_.
  1102. * Made ``print`` and ``vprint`` report I/O errors
  1103. (`#1098 <https://github.com/fmtlib/fmt/issues/1098>`_,
  1104. `#1099 <https://github.com/fmtlib/fmt/pull/1099>`_).
  1105. Thanks `@BillyDonahue (Billy Donahue) <https://github.com/BillyDonahue>`_.
  1106. * Marked deprecated APIs with the ``[[deprecated]]`` attribute and removed
  1107. internal uses of deprecated APIs
  1108. (`#1022 <https://github.com/fmtlib/fmt/pull/1022>`_).
  1109. Thanks `@eliaskosunen (Elias Kosunen) <https://github.com/eliaskosunen>`_.
  1110. * Modernized the codebase using more C++11 features and removing workarounds.
  1111. Most importantly, ``buffer_context`` is now an alias template, so
  1112. use ``buffer_context<T>`` instead of ``buffer_context<T>::type``.
  1113. These features require GCC 4.8 or later.
  1114. * ``formatter`` specializations now always take precedence over implicit
  1115. conversions to ``int`` and the undocumented ``convert_to_int`` trait
  1116. is now deprecated.
  1117. * Moved the undocumented ``basic_writer``, ``writer``, and ``wwriter`` types
  1118. to the ``internal`` namespace.
  1119. * Removed deprecated ``basic_format_context::begin()``. Use ``out()`` instead.
  1120. * Disallowed passing the result of ``join`` as an lvalue to prevent misuse.
  1121. * Refactored the undocumented structs that represent parsed format specifiers
  1122. to simplify the API and allow multibyte fill.
  1123. * Moved SFINAE to template parameters to reduce symbol sizes.
  1124. * Switched to ``fputws`` for writing wide strings so that it's no longer
  1125. required to call ``_setmode`` on Windows
  1126. (`#1229 <https://github.com/fmtlib/fmt/issues/1229>`_,
  1127. `#1243 <https://github.com/fmtlib/fmt/pull/1243>`_).
  1128. Thanks `@jackoalan (Jack Andersen) <https://github.com/jackoalan>`_.
  1129. * Improved literal-based API
  1130. (`#1254 <https://github.com/fmtlib/fmt/pull/1254>`_).
  1131. Thanks `@sylveon (Charles Milette) <https://github.com/sylveon>`_.
  1132. * Added support for exotic platforms without ``uintptr_t`` such as IBM i
  1133. (AS/400) which has 128-bit pointers and only 64-bit integers
  1134. (`#1059 <https://github.com/fmtlib/fmt/issues/1059>`_).
  1135. * Added `Sublime Text syntax highlighting config
  1136. <https://github.com/fmtlib/fmt/blob/master/support/C%2B%2B.sublime-syntax>`_
  1137. (`#1037 <https://github.com/fmtlib/fmt/issues/1037>`_).
  1138. Thanks `@Kronuz (Germán Méndez Bravo) <https://github.com/Kronuz>`_.
  1139. * Added the ``FMT_ENFORCE_COMPILE_STRING`` macro to enforce the use of
  1140. compile-time format strings
  1141. (`#1231 <https://github.com/fmtlib/fmt/pull/1231>`_).
  1142. Thanks `@jackoalan (Jack Andersen) <https://github.com/jackoalan>`_.
  1143. * Stopped setting ``CMAKE_BUILD_TYPE`` if {fmt} is a subproject
  1144. (`#1081 <https://github.com/fmtlib/fmt/issues/1081>`_).
  1145. * Various build improvements
  1146. (`#1039 <https://github.com/fmtlib/fmt/pull/1039>`_,
  1147. `#1078 <https://github.com/fmtlib/fmt/pull/1078>`_,
  1148. `#1091 <https://github.com/fmtlib/fmt/pull/1091>`_,
  1149. `#1103 <https://github.com/fmtlib/fmt/pull/1103>`_,
  1150. `#1177 <https://github.com/fmtlib/fmt/pull/1177>`_).
  1151. Thanks `@luncliff (Park DongHa) <https://github.com/luncliff>`_,
  1152. `@jasonszang (Jason Shuo Zang) <https://github.com/jasonszang>`_,
  1153. `@olafhering (Olaf Hering) <https://github.com/olafhering>`_,
  1154. `@Lecetem <https://github.com/Lectem>`_,
  1155. `@pauldreik (Paul Dreik) <https://github.com/pauldreik>`_.
  1156. * Improved documentation
  1157. (`#1049 <https://github.com/fmtlib/fmt/issues/1049>`_,
  1158. `#1051 <https://github.com/fmtlib/fmt/pull/1051>`_,
  1159. `#1083 <https://github.com/fmtlib/fmt/pull/1083>`_,
  1160. `#1113 <https://github.com/fmtlib/fmt/pull/1113>`_,
  1161. `#1114 <https://github.com/fmtlib/fmt/pull/1114>`_,
  1162. `#1146 <https://github.com/fmtlib/fmt/issues/1146>`_,
  1163. `#1180 <https://github.com/fmtlib/fmt/issues/1180>`_,
  1164. `#1250 <https://github.com/fmtlib/fmt/pull/1250>`_,
  1165. `#1252 <https://github.com/fmtlib/fmt/pull/1252>`_,
  1166. `#1265 <https://github.com/fmtlib/fmt/pull/1265>`_).
  1167. Thanks `@mikelui (Michael Lui) <https://github.com/mikelui>`_,
  1168. `@foonathan (Jonathan Müller) <https://github.com/foonathan>`_,
  1169. `@BillyDonahue (Billy Donahue) <https://github.com/BillyDonahue>`_,
  1170. `@jwakely (Jonathan Wakely) <https://github.com/jwakely>`_,
  1171. `@kaisbe (Kais Ben Salah) <https://github.com/kaisbe>`_,
  1172. `@sdebionne (Samuel Debionne) <https://github.com/sdebionne>`_.
  1173. * Fixed ambiguous formatter specialization in ``fmt/ranges.h``
  1174. (`#1123 <https://github.com/fmtlib/fmt/issues/1123>`_).
  1175. * Fixed formatting of a non-empty ``std::filesystem::path`` which is an
  1176. infinitely deep range of its components
  1177. (`#1268 <https://github.com/fmtlib/fmt/issues/1268>`_).
  1178. * Fixed handling of general output iterators when formatting characters
  1179. (`#1056 <https://github.com/fmtlib/fmt/issues/1056>`_,
  1180. `#1058 <https://github.com/fmtlib/fmt/pull/1058>`_).
  1181. Thanks `@abolz (Alexander Bolz) <https://github.com/abolz>`_.
  1182. * Fixed handling of output iterators in ``formatter`` specialization for
  1183. ranges (`#1064 <https://github.com/fmtlib/fmt/issues/1064>`_).
  1184. * Fixed handling of exotic character types
  1185. (`#1188 <https://github.com/fmtlib/fmt/issues/1188>`_).
  1186. * Made chrono formatting work with exceptions disabled
  1187. (`#1062 <https://github.com/fmtlib/fmt/issues/1062>`_).
  1188. * Fixed DLL visibility issues
  1189. (`#1134 <https://github.com/fmtlib/fmt/pull/1134>`_,
  1190. `#1147 <https://github.com/fmtlib/fmt/pull/1147>`_).
  1191. Thanks `@denchat <https://github.com/denchat>`_.
  1192. * Disabled the use of UDL template extension on GCC 9
  1193. (`#1148 <https://github.com/fmtlib/fmt/issues/1148>`_).
  1194. * Removed misplaced ``format`` compile-time checks from ``printf``
  1195. (`#1173 <https://github.com/fmtlib/fmt/issues/1173>`_).
  1196. * Fixed issues in the experimental floating-point formatter
  1197. (`#1072 <https://github.com/fmtlib/fmt/issues/1072>`_,
  1198. `#1129 <https://github.com/fmtlib/fmt/issues/1129>`_,
  1199. `#1153 <https://github.com/fmtlib/fmt/issues/1153>`_,
  1200. `#1155 <https://github.com/fmtlib/fmt/pull/1155>`_,
  1201. `#1210 <https://github.com/fmtlib/fmt/issues/1210>`_,
  1202. `#1222 <https://github.com/fmtlib/fmt/issues/1222>`_).
  1203. Thanks `@alabuzhev (Alex Alabuzhev) <https://github.com/alabuzhev>`_.
  1204. * Fixed bugs discovered by fuzzing or during fuzzing integration
  1205. (`#1124 <https://github.com/fmtlib/fmt/issues/1124>`_,
  1206. `#1127 <https://github.com/fmtlib/fmt/issues/1127>`_,
  1207. `#1132 <https://github.com/fmtlib/fmt/issues/1132>`_,
  1208. `#1135 <https://github.com/fmtlib/fmt/pull/1135>`_,
  1209. `#1136 <https://github.com/fmtlib/fmt/issues/1136>`_,
  1210. `#1141 <https://github.com/fmtlib/fmt/issues/1141>`_,
  1211. `#1142 <https://github.com/fmtlib/fmt/issues/1142>`_,
  1212. `#1178 <https://github.com/fmtlib/fmt/issues/1178>`_,
  1213. `#1179 <https://github.com/fmtlib/fmt/issues/1179>`_,
  1214. `#1194 <https://github.com/fmtlib/fmt/issues/1194>`_).
  1215. Thanks `@pauldreik (Paul Dreik) <https://github.com/pauldreik>`_.
  1216. * Fixed building tests on FreeBSD and Hurd
  1217. (`#1043 <https://github.com/fmtlib/fmt/issues/1043>`_).
  1218. Thanks `@jackyf (Eugene V. Lyubimkin) <https://github.com/jackyf>`_.
  1219. * Fixed various warnings and compilation issues
  1220. (`#998 <https://github.com/fmtlib/fmt/pull/998>`_,
  1221. `#1006 <https://github.com/fmtlib/fmt/pull/1006>`_,
  1222. `#1008 <https://github.com/fmtlib/fmt/issues/1008>`_,
  1223. `#1011 <https://github.com/fmtlib/fmt/issues/1011>`_,
  1224. `#1025 <https://github.com/fmtlib/fmt/issues/1025>`_,
  1225. `#1027 <https://github.com/fmtlib/fmt/pull/1027>`_,
  1226. `#1028 <https://github.com/fmtlib/fmt/pull/1028>`_,
  1227. `#1029 <https://github.com/fmtlib/fmt/pull/1029>`_,
  1228. `#1030 <https://github.com/fmtlib/fmt/pull/1030>`_,
  1229. `#1031 <https://github.com/fmtlib/fmt/pull/1031>`_,
  1230. `#1054 <https://github.com/fmtlib/fmt/pull/1054>`_,
  1231. `#1063 <https://github.com/fmtlib/fmt/issues/1063>`_,
  1232. `#1068 <https://github.com/fmtlib/fmt/pull/1068>`_,
  1233. `#1074 <https://github.com/fmtlib/fmt/pull/1074>`_,
  1234. `#1075 <https://github.com/fmtlib/fmt/pull/1075>`_,
  1235. `#1079 <https://github.com/fmtlib/fmt/pull/1079>`_,
  1236. `#1086 <https://github.com/fmtlib/fmt/pull/1086>`_,
  1237. `#1088 <https://github.com/fmtlib/fmt/issues/1088>`_,
  1238. `#1089 <https://github.com/fmtlib/fmt/pull/1089>`_,
  1239. `#1094 <https://github.com/fmtlib/fmt/pull/1094>`_,
  1240. `#1101 <https://github.com/fmtlib/fmt/issues/1101>`_,
  1241. `#1102 <https://github.com/fmtlib/fmt/pull/1102>`_,
  1242. `#1105 <https://github.com/fmtlib/fmt/issues/1105>`_,
  1243. `#1107 <https://github.com/fmtlib/fmt/pull/1107>`_,
  1244. `#1115 <https://github.com/fmtlib/fmt/issues/1115>`_,
  1245. `#1117 <https://github.com/fmtlib/fmt/issues/1117>`_,
  1246. `#1118 <https://github.com/fmtlib/fmt/issues/1118>`_,
  1247. `#1120 <https://github.com/fmtlib/fmt/issues/1120>`_,
  1248. `#1123 <https://github.com/fmtlib/fmt/issues/1123>`_,
  1249. `#1139 <https://github.com/fmtlib/fmt/pull/1139>`_,
  1250. `#1140 <https://github.com/fmtlib/fmt/issues/1140>`_,
  1251. `#1143 <https://github.com/fmtlib/fmt/issues/1143>`_,
  1252. `#1144 <https://github.com/fmtlib/fmt/pull/1144>`_,
  1253. `#1150 <https://github.com/fmtlib/fmt/pull/1150>`_,
  1254. `#1151 <https://github.com/fmtlib/fmt/pull/1151>`_,
  1255. `#1152 <https://github.com/fmtlib/fmt/issues/1152>`_,
  1256. `#1154 <https://github.com/fmtlib/fmt/issues/1154>`_,
  1257. `#1156 <https://github.com/fmtlib/fmt/issues/1156>`_,
  1258. `#1159 <https://github.com/fmtlib/fmt/pull/1159>`_,
  1259. `#1175 <https://github.com/fmtlib/fmt/issues/1175>`_,
  1260. `#1181 <https://github.com/fmtlib/fmt/issues/1181>`_,
  1261. `#1186 <https://github.com/fmtlib/fmt/issues/1186>`_,
  1262. `#1187 <https://github.com/fmtlib/fmt/pull/1187>`_,
  1263. `#1191 <https://github.com/fmtlib/fmt/pull/1191>`_,
  1264. `#1197 <https://github.com/fmtlib/fmt/issues/1197>`_,
  1265. `#1200 <https://github.com/fmtlib/fmt/issues/1200>`_,
  1266. `#1203 <https://github.com/fmtlib/fmt/issues/1203>`_,
  1267. `#1205 <https://github.com/fmtlib/fmt/issues/1205>`_,
  1268. `#1206 <https://github.com/fmtlib/fmt/pull/1206>`_,
  1269. `#1213 <https://github.com/fmtlib/fmt/issues/1213>`_,
  1270. `#1214 <https://github.com/fmtlib/fmt/issues/1214>`_,
  1271. `#1217 <https://github.com/fmtlib/fmt/pull/1217>`_,
  1272. `#1228 <https://github.com/fmtlib/fmt/issues/1228>`_,
  1273. `#1230 <https://github.com/fmtlib/fmt/pull/1230>`_,
  1274. `#1232 <https://github.com/fmtlib/fmt/issues/1232>`_,
  1275. `#1235 <https://github.com/fmtlib/fmt/pull/1235>`_,
  1276. `#1236 <https://github.com/fmtlib/fmt/pull/1236>`_,
  1277. `#1240 <https://github.com/fmtlib/fmt/issues/1240>`_).
  1278. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_,
  1279. `@mwinterb <https://github.com/mwinterb>`_,
  1280. `@eliaskosunen (Elias Kosunen) <https://github.com/eliaskosunen>`_,
  1281. `@morinmorin <https://github.com/morinmorin>`_,
  1282. `@ricco19 (Brian Ricciardelli) <https://github.com/ricco19>`_,
  1283. `@waywardmonkeys (Bruce Mitchener) <https://github.com/waywardmonkeys>`_,
  1284. `@chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>`_,
  1285. `@remyabel <https://github.com/remyabel>`_,
  1286. `@pauldreik (Paul Dreik) <https://github.com/pauldreik>`_,
  1287. `@gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>`_,
  1288. `@rcane (Ronny Krüger) <https://github.com/rcane>`_,
  1289. `@mocabe <https://github.com/mocabe>`_,
  1290. `@denchat <https://github.com/denchat>`_,
  1291. `@cjdb (Christopher Di Bella) <https://github.com/cjdb>`_,
  1292. `@HazardyKnusperkeks (Björn Schäpers) <https://github.com/HazardyKnusperkeks>`_,
  1293. `@vedranmiletic (Vedran Miletić) <https://github.com/vedranmiletic>`_,
  1294. `@jackoalan (Jack Andersen) <https://github.com/jackoalan>`_,
  1295. `@DaanDeMeyer (Daan De Meyer) <https://github.com/DaanDeMeyer>`_,
  1296. `@starkmapper (Mark Stapper) <https://github.com/starkmapper>`_.
  1297. 5.3.0 - 2018-12-28
  1298. ------------------
  1299. * Introduced experimental chrono formatting support:
  1300. .. code:: c++
  1301. #include <fmt/chrono.h>
  1302. int main() {
  1303. using namespace std::literals::chrono_literals;
  1304. fmt::print("Default format: {} {}\n", 42s, 100ms);
  1305. fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s);
  1306. }
  1307. prints::
  1308. Default format: 42s 100ms
  1309. strftime-like format: 03:15:30
  1310. * Added experimental support for emphasis (bold, italic, underline,
  1311. strikethrough), colored output to a file stream, and improved colored
  1312. formatting API
  1313. (`#961 <https://github.com/fmtlib/fmt/pull/961>`_,
  1314. `#967 <https://github.com/fmtlib/fmt/pull/967>`_,
  1315. `#973 <https://github.com/fmtlib/fmt/pull/973>`_):
  1316. .. code:: c++
  1317. #include <fmt/color.h>
  1318. int main() {
  1319. print(fg(fmt::color::crimson) | fmt::emphasis::bold,
  1320. "Hello, {}!\n", "world");
  1321. print(fg(fmt::color::floral_white) | bg(fmt::color::slate_gray) |
  1322. fmt::emphasis::underline, "Hello, {}!\n", "мир");
  1323. print(fg(fmt::color::steel_blue) | fmt::emphasis::italic,
  1324. "Hello, {}!\n", "世界");
  1325. }
  1326. prints the following on modern terminals with RGB color support:
  1327. .. image:: https://user-images.githubusercontent.com/576385/
  1328. 50405788-b66e7500-076e-11e9-9592-7324d1f951d8.png
  1329. Thanks `@Rakete1111 (Nicolas) <https://github.com/Rakete1111>`_.
  1330. * Added support for 4-bit terminal colors
  1331. (`#968 <https://github.com/fmtlib/fmt/issues/968>`_,
  1332. `#974 <https://github.com/fmtlib/fmt/pull/974>`_)
  1333. .. code:: c++
  1334. #include <fmt/color.h>
  1335. int main() {
  1336. print(fg(fmt::terminal_color::red), "stop\n");
  1337. }
  1338. Note that these colors vary by terminal:
  1339. .. image:: https://user-images.githubusercontent.com/576385/
  1340. 50405925-dbfc7e00-0770-11e9-9b85-333fab0af9ac.png
  1341. Thanks `@Rakete1111 (Nicolas) <https://github.com/Rakete1111>`_.
  1342. * Parameterized formatting functions on the type of the format string
  1343. (`#880 <https://github.com/fmtlib/fmt/issues/880>`_,
  1344. `#881 <https://github.com/fmtlib/fmt/pull/881>`_,
  1345. `#883 <https://github.com/fmtlib/fmt/pull/883>`_,
  1346. `#885 <https://github.com/fmtlib/fmt/pull/885>`_,
  1347. `#897 <https://github.com/fmtlib/fmt/pull/897>`_,
  1348. `#920 <https://github.com/fmtlib/fmt/issues/920>`_).
  1349. Any object of type ``S`` that has an overloaded ``to_string_view(const S&)``
  1350. returning ``fmt::string_view`` can be used as a format string:
  1351. .. code:: c++
  1352. namespace my_ns {
  1353. inline string_view to_string_view(const my_string& s) {
  1354. return {s.data(), s.length()};
  1355. }
  1356. }
  1357. std::string message = fmt::format(my_string("The answer is {}."), 42);
  1358. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1359. * Made ``std::string_view`` work as a format string
  1360. (`#898 <https://github.com/fmtlib/fmt/pull/898>`_):
  1361. .. code:: c++
  1362. auto message = fmt::format(std::string_view("The answer is {}."), 42);
  1363. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1364. * Added wide string support to compile-time format string checks
  1365. (`#924 <https://github.com/fmtlib/fmt/pull/924>`_):
  1366. .. code:: c++
  1367. print(fmt(L"{:f}"), 42); // compile-time error: invalid type specifier
  1368. Thanks `@XZiar <https://github.com/XZiar>`_.
  1369. * Made colored print functions work with wide strings
  1370. (`#867 <https://github.com/fmtlib/fmt/pull/867>`_):
  1371. .. code:: c++
  1372. #include <fmt/color.h>
  1373. int main() {
  1374. print(fg(fmt::color::red), L"{}\n", 42);
  1375. }
  1376. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1377. * Introduced experimental Unicode support
  1378. (`#628 <https://github.com/fmtlib/fmt/issues/628>`_,
  1379. `#891 <https://github.com/fmtlib/fmt/pull/891>`_):
  1380. .. code:: c++
  1381. using namespace fmt::literals;
  1382. auto s = fmt::format("{:*^5}"_u, "🤡"_u); // s == "**🤡**"_u
  1383. * Improved locale support:
  1384. .. code:: c++
  1385. #include <fmt/locale.h>
  1386. struct numpunct : std::numpunct<char> {
  1387. protected:
  1388. char do_thousands_sep() const override { return '~'; }
  1389. };
  1390. std::locale loc;
  1391. auto s = fmt::format(std::locale(loc, new numpunct()), "{:n}", 1234567);
  1392. // s == "1~234~567"
  1393. * Constrained formatting functions on proper iterator types
  1394. (`#921 <https://github.com/fmtlib/fmt/pull/921>`_).
  1395. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1396. * Added ``make_printf_args`` and ``make_wprintf_args`` functions
  1397. (`#934 <https://github.com/fmtlib/fmt/pull/934>`_).
  1398. Thanks `@tnovotny <https://github.com/tnovotny>`_.
  1399. * Deprecated ``fmt::visit``, ``parse_context``, and ``wparse_context``.
  1400. Use ``fmt::visit_format_arg``, ``format_parse_context``, and
  1401. ``wformat_parse_context`` instead.
  1402. * Removed undocumented ``basic_fixed_buffer`` which has been superseded by the
  1403. iterator-based API
  1404. (`#873 <https://github.com/fmtlib/fmt/issues/873>`_,
  1405. `#902 <https://github.com/fmtlib/fmt/pull/902>`_).
  1406. Thanks `@superfunc (hollywood programmer) <https://github.com/superfunc>`_.
  1407. * Disallowed repeated leading zeros in an argument ID:
  1408. .. code:: c++
  1409. fmt::print("{000}", 42); // error
  1410. * Reintroduced support for gcc 4.4.
  1411. * Fixed compilation on platforms with exotic ``double``
  1412. (`#878 <https://github.com/fmtlib/fmt/issues/878>`_).
  1413. * Improved documentation
  1414. (`#164 <https://github.com/fmtlib/fmt/issues/164>`_,
  1415. `#877 <https://github.com/fmtlib/fmt/issues/877>`_,
  1416. `#901 <https://github.com/fmtlib/fmt/pull/901>`_,
  1417. `#906 <https://github.com/fmtlib/fmt/pull/906>`_,
  1418. `#979 <https://github.com/fmtlib/fmt/pull/979>`_).
  1419. Thanks `@kookjr (Mathew Cucuzella) <https://github.com/kookjr>`_,
  1420. `@DarkDimius (Dmitry Petrashko) <https://github.com/DarkDimius>`_,
  1421. `@HecticSerenity <https://github.com/HecticSerenity>`_.
  1422. * Added pkgconfig support which makes it easier to consume the library from
  1423. meson and other build systems
  1424. (`#916 <https://github.com/fmtlib/fmt/pull/916>`_).
  1425. Thanks `@colemickens (Cole Mickens) <https://github.com/colemickens>`_.
  1426. * Various build improvements
  1427. (`#909 <https://github.com/fmtlib/fmt/pull/909>`_,
  1428. `#926 <https://github.com/fmtlib/fmt/pull/926>`_,
  1429. `#937 <https://github.com/fmtlib/fmt/pull/937>`_,
  1430. `#953 <https://github.com/fmtlib/fmt/pull/953>`_,
  1431. `#959 <https://github.com/fmtlib/fmt/pull/959>`_).
  1432. Thanks `@tchaikov (Kefu Chai) <https://github.com/tchaikov>`_,
  1433. `@luncliff (Park DongHa) <https://github.com/luncliff>`_,
  1434. `@AndreasSchoenle (Andreas Schönle) <https://github.com/AndreasSchoenle>`_,
  1435. `@hotwatermorning <https://github.com/hotwatermorning>`_,
  1436. `@Zefz (JohanJansen) <https://github.com/Zefz>`_.
  1437. * Improved ``string_view`` construction performance
  1438. (`#914 <https://github.com/fmtlib/fmt/pull/914>`_).
  1439. Thanks `@gabime (Gabi Melman) <https://github.com/gabime>`_.
  1440. * Fixed non-matching char types
  1441. (`#895 <https://github.com/fmtlib/fmt/pull/895>`_).
  1442. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1443. * Fixed ``format_to_n`` with ``std::back_insert_iterator``
  1444. (`#913 <https://github.com/fmtlib/fmt/pull/913>`_).
  1445. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1446. * Fixed locale-dependent formatting
  1447. (`#905 <https://github.com/fmtlib/fmt/issues/905>`_).
  1448. * Fixed various compiler warnings and errors
  1449. (`#882 <https://github.com/fmtlib/fmt/pull/882>`_,
  1450. `#886 <https://github.com/fmtlib/fmt/pull/886>`_,
  1451. `#933 <https://github.com/fmtlib/fmt/pull/933>`_,
  1452. `#941 <https://github.com/fmtlib/fmt/pull/941>`_,
  1453. `#931 <https://github.com/fmtlib/fmt/issues/931>`_,
  1454. `#943 <https://github.com/fmtlib/fmt/pull/943>`_,
  1455. `#954 <https://github.com/fmtlib/fmt/pull/954>`_,
  1456. `#956 <https://github.com/fmtlib/fmt/pull/956>`_,
  1457. `#962 <https://github.com/fmtlib/fmt/pull/962>`_,
  1458. `#965 <https://github.com/fmtlib/fmt/issues/965>`_,
  1459. `#977 <https://github.com/fmtlib/fmt/issues/977>`_,
  1460. `#983 <https://github.com/fmtlib/fmt/pull/983>`_,
  1461. `#989 <https://github.com/fmtlib/fmt/pull/989>`_).
  1462. Thanks `@Luthaf (Guillaume Fraux) <https://github.com/Luthaf>`_,
  1463. `@stevenhoving (Steven Hoving) <https://github.com/stevenhoving>`_,
  1464. `@christinaa (Kristina Brooks) <https://github.com/christinaa>`_,
  1465. `@lgritz (Larry Gritz) <https://github.com/lgritz>`_,
  1466. `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_,
  1467. `@0x8000-0000 (Sign Bit) <https://github.com/0x8000-0000>`_,
  1468. `@liuping1997 <https://github.com/liuping1997>`_.
  1469. 5.2.1 - 2018-09-21
  1470. ------------------
  1471. * Fixed ``visit`` lookup issues on gcc 7 & 8
  1472. (`#870 <https://github.com/fmtlib/fmt/pull/870>`_).
  1473. Thanks `@medithe <https://github.com/medithe>`_.
  1474. * Fixed linkage errors on older gcc.
  1475. * Prevented ``fmt/range.h`` from specializing ``fmt::basic_string_view``
  1476. (`#865 <https://github.com/fmtlib/fmt/issues/865>`_,
  1477. `#868 <https://github.com/fmtlib/fmt/pull/868>`_).
  1478. Thanks `@hhggit (dual) <https://github.com/hhggit>`_.
  1479. * Improved error message when formatting unknown types
  1480. (`#872 <https://github.com/fmtlib/fmt/pull/872>`_).
  1481. Thanks `@foonathan (Jonathan Müller) <https://github.com/foonathan>`_,
  1482. * Disabled templated user-defined literals when compiled under nvcc
  1483. (`#875 <https://github.com/fmtlib/fmt/pull/875>`_).
  1484. Thanks `@CandyGumdrop (Candy Gumdrop) <https://github.com/CandyGumdrop>`_,
  1485. * Fixed ``format_to`` formatting to ``wmemory_buffer``
  1486. (`#874 <https://github.com/fmtlib/fmt/issues/874>`_).
  1487. 5.2.0 - 2018-09-13
  1488. ------------------
  1489. * Optimized format string parsing and argument processing which resulted in up
  1490. to 5x speed up on long format strings and significant performance boost on
  1491. various benchmarks. For example, version 5.2 is 2.22x faster than 5.1 on
  1492. decimal integer formatting with ``format_to`` (macOS, clang-902.0.39.2):
  1493. ================== ======= =======
  1494. Method Time, s Speedup
  1495. ================== ======= =======
  1496. fmt::format 5.1 0.58
  1497. fmt::format 5.2 0.35 1.66x
  1498. fmt::format_to 5.1 0.51
  1499. fmt::format_to 5.2 0.23 2.22x
  1500. sprintf 0.71
  1501. std::to_string 1.01
  1502. std::stringstream 1.73
  1503. ================== ======= =======
  1504. * Changed the ``fmt`` macro from opt-out to opt-in to prevent name collisions.
  1505. To enable it define the ``FMT_STRING_ALIAS`` macro to 1 before including
  1506. ``fmt/format.h``:
  1507. .. code:: c++
  1508. #define FMT_STRING_ALIAS 1
  1509. #include <fmt/format.h>
  1510. std::string answer = format(fmt("{}"), 42);
  1511. * Added compile-time format string checks to ``format_to`` overload that takes
  1512. ``fmt::memory_buffer`` (`#783 <https://github.com/fmtlib/fmt/issues/783>`_):
  1513. .. code:: c++
  1514. fmt::memory_buffer buf;
  1515. // Compile-time error: invalid type specifier.
  1516. fmt::format_to(buf, fmt("{:d}"), "foo");
  1517. * Moved experimental color support to ``fmt/color.h`` and enabled the
  1518. new API by default. The old API can be enabled by defining the
  1519. ``FMT_DEPRECATED_COLORS`` macro.
  1520. * Added formatting support for types explicitly convertible to
  1521. ``fmt::string_view``:
  1522. .. code:: c++
  1523. struct foo {
  1524. explicit operator fmt::string_view() const { return "foo"; }
  1525. };
  1526. auto s = format("{}", foo());
  1527. In particular, this makes formatting function work with
  1528. ``folly::StringPiece``.
  1529. * Implemented preliminary support for ``char*_t`` by replacing the ``format``
  1530. function overloads with a single function template parameterized on the string
  1531. type.
  1532. * Added support for dynamic argument lists
  1533. (`#814 <https://github.com/fmtlib/fmt/issues/814>`_,
  1534. `#819 <https://github.com/fmtlib/fmt/pull/819>`_).
  1535. Thanks `@MikePopoloski (Michael Popoloski)
  1536. <https://github.com/MikePopoloski>`_.
  1537. * Reduced executable size overhead for embedded targets using newlib nano by
  1538. making locale dependency optional
  1539. (`#839 <https://github.com/fmtlib/fmt/pull/839>`_).
  1540. Thanks `@teajay-fr (Thomas Benard) <https://github.com/teajay-fr>`_.
  1541. * Keep ``noexcept`` specifier when exceptions are disabled
  1542. (`#801 <https://github.com/fmtlib/fmt/issues/801>`_,
  1543. `#810 <https://github.com/fmtlib/fmt/pull/810>`_).
  1544. Thanks `@qis (Alexej Harm) <https://github.com/qis>`_.
  1545. * Fixed formatting of user-defined types providing ``operator<<`` with
  1546. ``format_to_n``
  1547. (`#806 <https://github.com/fmtlib/fmt/pull/806>`_).
  1548. Thanks `@mkurdej (Marek Kurdej) <https://github.com/mkurdej>`_.
  1549. * Fixed dynamic linkage of new symbols
  1550. (`#808 <https://github.com/fmtlib/fmt/issues/808>`_).
  1551. * Fixed global initialization issue
  1552. (`#807 <https://github.com/fmtlib/fmt/issues/807>`_):
  1553. .. code:: c++
  1554. // This works on compilers with constexpr support.
  1555. static const std::string answer = fmt::format("{}", 42);
  1556. * Fixed various compiler warnings and errors
  1557. (`#804 <https://github.com/fmtlib/fmt/pull/804>`_,
  1558. `#809 <https://github.com/fmtlib/fmt/issues/809>`_,
  1559. `#811 <https://github.com/fmtlib/fmt/pull/811>`_,
  1560. `#822 <https://github.com/fmtlib/fmt/issues/822>`_,
  1561. `#827 <https://github.com/fmtlib/fmt/pull/827>`_,
  1562. `#830 <https://github.com/fmtlib/fmt/issues/830>`_,
  1563. `#838 <https://github.com/fmtlib/fmt/pull/838>`_,
  1564. `#843 <https://github.com/fmtlib/fmt/issues/843>`_,
  1565. `#844 <https://github.com/fmtlib/fmt/pull/844>`_,
  1566. `#851 <https://github.com/fmtlib/fmt/issues/851>`_,
  1567. `#852 <https://github.com/fmtlib/fmt/pull/852>`_,
  1568. `#854 <https://github.com/fmtlib/fmt/pull/854>`_).
  1569. Thanks `@henryiii (Henry Schreiner) <https://github.com/henryiii>`_,
  1570. `@medithe <https://github.com/medithe>`_, and
  1571. `@eliasdaler (Elias Daler) <https://github.com/eliasdaler>`_.
  1572. 5.1.0 - 2018-07-05
  1573. ------------------
  1574. * Added experimental support for RGB color output enabled with
  1575. the ``FMT_EXTENDED_COLORS`` macro:
  1576. .. code:: c++
  1577. #define FMT_EXTENDED_COLORS
  1578. #define FMT_HEADER_ONLY // or compile fmt with FMT_EXTENDED_COLORS defined
  1579. #include <fmt/format.h>
  1580. fmt::print(fmt::color::steel_blue, "Some beautiful text");
  1581. The old API (the ``print_colored`` and ``vprint_colored`` functions and the
  1582. ``color`` enum) is now deprecated.
  1583. (`#762 <https://github.com/fmtlib/fmt/issues/762>`_
  1584. `#767 <https://github.com/fmtlib/fmt/pull/767>`_).
  1585. thanks `@Remotion (Remo) <https://github.com/Remotion>`_.
  1586. * Added quotes to strings in ranges and tuples
  1587. (`#766 <https://github.com/fmtlib/fmt/pull/766>`_).
  1588. Thanks `@Remotion (Remo) <https://github.com/Remotion>`_.
  1589. * Made ``format_to`` work with ``basic_memory_buffer``
  1590. (`#776 <https://github.com/fmtlib/fmt/issues/776>`_).
  1591. * Added ``vformat_to_n`` and ``wchar_t`` overload of ``format_to_n``
  1592. (`#764 <https://github.com/fmtlib/fmt/issues/764>`_,
  1593. `#769 <https://github.com/fmtlib/fmt/issues/769>`_).
  1594. * Made ``is_range`` and ``is_tuple_like`` part of public (experimental) API
  1595. to allow specialization for user-defined types
  1596. (`#751 <https://github.com/fmtlib/fmt/issues/751>`_,
  1597. `#759 <https://github.com/fmtlib/fmt/pull/759>`_).
  1598. Thanks `@drrlvn (Dror Levin) <https://github.com/drrlvn>`_.
  1599. * Added more compilers to continuous integration and increased ``FMT_PEDANTIC``
  1600. warning levels
  1601. (`#736 <https://github.com/fmtlib/fmt/pull/736>`_).
  1602. Thanks `@eliaskosunen (Elias Kosunen) <https://github.com/eliaskosunen>`_.
  1603. * Fixed compilation with MSVC 2013.
  1604. * Fixed handling of user-defined types in ``format_to``
  1605. (`#793 <https://github.com/fmtlib/fmt/issues/793>`_).
  1606. * Forced linking of inline ``vformat`` functions into the library
  1607. (`#795 <https://github.com/fmtlib/fmt/issues/795>`_).
  1608. * Fixed incorrect call to on_align in ``'{:}='``
  1609. (`#750 <https://github.com/fmtlib/fmt/issues/750>`_).
  1610. * Fixed floating-point formatting to a non-back_insert_iterator with sign &
  1611. numeric alignment specified
  1612. (`#756 <https://github.com/fmtlib/fmt/issues/756>`_).
  1613. * Fixed formatting to an array with ``format_to_n``
  1614. (`#778 <https://github.com/fmtlib/fmt/issues/778>`_).
  1615. * Fixed formatting of more than 15 named arguments
  1616. (`#754 <https://github.com/fmtlib/fmt/issues/754>`_).
  1617. * Fixed handling of compile-time strings when including ``fmt/ostream.h``.
  1618. (`#768 <https://github.com/fmtlib/fmt/issues/768>`_).
  1619. * Fixed various compiler warnings and errors
  1620. (`#742 <https://github.com/fmtlib/fmt/issues/742>`_,
  1621. `#748 <https://github.com/fmtlib/fmt/issues/748>`_,
  1622. `#752 <https://github.com/fmtlib/fmt/issues/752>`_,
  1623. `#770 <https://github.com/fmtlib/fmt/issues/770>`_,
  1624. `#775 <https://github.com/fmtlib/fmt/pull/775>`_,
  1625. `#779 <https://github.com/fmtlib/fmt/issues/779>`_,
  1626. `#780 <https://github.com/fmtlib/fmt/pull/780>`_,
  1627. `#790 <https://github.com/fmtlib/fmt/pull/790>`_,
  1628. `#792 <https://github.com/fmtlib/fmt/pull/792>`_,
  1629. `#800 <https://github.com/fmtlib/fmt/pull/800>`_).
  1630. Thanks `@Remotion (Remo) <https://github.com/Remotion>`_,
  1631. `@gabime (Gabi Melman) <https://github.com/gabime>`_,
  1632. `@foonathan (Jonathan Müller) <https://github.com/foonathan>`_,
  1633. `@Dark-Passenger (Dhruv Paranjape) <https://github.com/Dark-Passenger>`_, and
  1634. `@0x8000-0000 (Sign Bit) <https://github.com/0x8000-0000>`_.
  1635. 5.0.0 - 2018-05-21
  1636. ------------------
  1637. * Added a requirement for partial C++11 support, most importantly variadic
  1638. templates and type traits, and dropped ``FMT_VARIADIC_*`` emulation macros.
  1639. Variadic templates are available since GCC 4.4, Clang 2.9 and MSVC 18.0 (2013).
  1640. For older compilers use {fmt} `version 4.x
  1641. <https://github.com/fmtlib/fmt/releases/tag/4.1.0>`_ which continues to be
  1642. maintained and works with C++98 compilers.
  1643. * Renamed symbols to follow standard C++ naming conventions and proposed a subset
  1644. of the library for standardization in `P0645R2 Text Formatting
  1645. <https://wg21.link/P0645>`_.
  1646. * Implemented ``constexpr`` parsing of format strings and `compile-time format
  1647. string checks
  1648. <https://fmt.dev/latest/api.html#compile-time-format-string-checks>`_. For
  1649. example
  1650. .. code:: c++
  1651. #include <fmt/format.h>
  1652. std::string s = format(fmt("{:d}"), "foo");
  1653. gives a compile-time error because ``d`` is an invalid specifier for strings
  1654. (`godbolt <https://godbolt.org/g/rnCy9Q>`__)::
  1655. ...
  1656. <source>:4:19: note: in instantiation of function template specialization 'fmt::v5::format<S, char [4]>' requested here
  1657. std::string s = format(fmt("{:d}"), "foo");
  1658. ^
  1659. format.h:1337:13: note: non-constexpr function 'on_error' cannot be used in a constant expression
  1660. handler.on_error("invalid type specifier");
  1661. Compile-time checks require relaxed ``constexpr`` (C++14 feature) support. If
  1662. the latter is not available, checks will be performed at runtime.
  1663. * Separated format string parsing and formatting in the extension API to enable
  1664. compile-time format string processing. For example
  1665. .. code:: c++
  1666. struct Answer {};
  1667. namespace fmt {
  1668. template <>
  1669. struct formatter<Answer> {
  1670. constexpr auto parse(parse_context& ctx) {
  1671. auto it = ctx.begin();
  1672. spec = *it;
  1673. if (spec != 'd' && spec != 's')
  1674. throw format_error("invalid specifier");
  1675. return ++it;
  1676. }
  1677. template <typename FormatContext>
  1678. auto format(Answer, FormatContext& ctx) {
  1679. return spec == 's' ?
  1680. format_to(ctx.begin(), "{}", "fourty-two") :
  1681. format_to(ctx.begin(), "{}", 42);
  1682. }
  1683. char spec = 0;
  1684. };
  1685. }
  1686. std::string s = format(fmt("{:x}"), Answer());
  1687. gives a compile-time error due to invalid format specifier (`godbolt
  1688. <https://godbolt.org/g/2jQ1Dv>`__)::
  1689. ...
  1690. <source>:12:45: error: expression '<throw-expression>' is not a constant expression
  1691. throw format_error("invalid specifier");
  1692. * Added `iterator support
  1693. <https://fmt.dev/latest/api.html#output-iterator-support>`_:
  1694. .. code:: c++
  1695. #include <vector>
  1696. #include <fmt/format.h>
  1697. std::vector<char> out;
  1698. fmt::format_to(std::back_inserter(out), "{}", 42);
  1699. * Added the `format_to_n
  1700. <https://fmt.dev/latest/api.html#_CPPv2N3fmt11format_to_nE8OutputItNSt6size_tE11string_viewDpRK4Args>`_
  1701. function that restricts the output to the specified number of characters
  1702. (`#298 <https://github.com/fmtlib/fmt/issues/298>`_):
  1703. .. code:: c++
  1704. char out[4];
  1705. fmt::format_to_n(out, sizeof(out), "{}", 12345);
  1706. // out == "1234" (without terminating '\0')
  1707. * Added the `formatted_size
  1708. <https://fmt.dev/latest/api.html#_CPPv2N3fmt14formatted_sizeE11string_viewDpRK4Args>`_
  1709. function for computing the output size:
  1710. .. code:: c++
  1711. #include <fmt/format.h>
  1712. auto size = fmt::formatted_size("{}", 12345); // size == 5
  1713. * Improved compile times by reducing dependencies on standard headers and
  1714. providing a lightweight `core API <https://fmt.dev/latest/api.html#core-api>`_:
  1715. .. code:: c++
  1716. #include <fmt/core.h>
  1717. fmt::print("The answer is {}.", 42);
  1718. See `Compile time and code bloat
  1719. <https://github.com/fmtlib/fmt#compile-time-and-code-bloat>`_.
  1720. * Added the `make_format_args
  1721. <https://fmt.dev/latest/api.html#_CPPv2N3fmt16make_format_argsEDpRK4Args>`_
  1722. function for capturing formatting arguments:
  1723. .. code:: c++
  1724. // Prints formatted error message.
  1725. void vreport_error(const char *format, fmt::format_args args) {
  1726. fmt::print("Error: ");
  1727. fmt::vprint(format, args);
  1728. }
  1729. template <typename... Args>
  1730. void report_error(const char *format, const Args & ... args) {
  1731. vreport_error(format, fmt::make_format_args(args...));
  1732. }
  1733. * Added the ``make_printf_args`` function for capturing ``printf`` arguments
  1734. (`#687 <https://github.com/fmtlib/fmt/issues/687>`_,
  1735. `#694 <https://github.com/fmtlib/fmt/pull/694>`_).
  1736. Thanks `@Kronuz (Germán Méndez Bravo) <https://github.com/Kronuz>`_.
  1737. * Added prefix ``v`` to non-variadic functions taking ``format_args`` to
  1738. distinguish them from variadic ones:
  1739. .. code:: c++
  1740. std::string vformat(string_view format_str, format_args args);
  1741. template <typename... Args>
  1742. std::string format(string_view format_str, const Args & ... args);
  1743. * Added experimental support for formatting ranges, containers and tuple-like
  1744. types in ``fmt/ranges.h`` (`#735 <https://github.com/fmtlib/fmt/pull/735>`_):
  1745. .. code:: c++
  1746. #include <fmt/ranges.h>
  1747. std::vector<int> v = {1, 2, 3};
  1748. fmt::print("{}", v); // prints {1, 2, 3}
  1749. Thanks `@Remotion (Remo) <https://github.com/Remotion>`_.
  1750. * Implemented ``wchar_t`` date and time formatting
  1751. (`#712 <https://github.com/fmtlib/fmt/pull/712>`_):
  1752. .. code:: c++
  1753. #include <fmt/time.h>
  1754. std::time_t t = std::time(nullptr);
  1755. auto s = fmt::format(L"The date is {:%Y-%m-%d}.", *std::localtime(&t));
  1756. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1757. * Provided more wide string overloads
  1758. (`#724 <https://github.com/fmtlib/fmt/pull/724>`_).
  1759. Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
  1760. * Switched from a custom null-terminated string view class to ``string_view``
  1761. in the format API and provided ``fmt::string_view`` which implements a subset
  1762. of ``std::string_view`` API for pre-C++17 systems.
  1763. * Added support for ``std::experimental::string_view``
  1764. (`#607 <https://github.com/fmtlib/fmt/pull/607>`_):
  1765. .. code:: c++
  1766. #include <fmt/core.h>
  1767. #include <experimental/string_view>
  1768. fmt::print("{}", std::experimental::string_view("foo"));
  1769. Thanks `@virgiliofornazin (Virgilio Alexandre Fornazin)
  1770. <https://github.com/virgiliofornazin>`__.
  1771. * Allowed mixing named and automatic arguments:
  1772. .. code:: c++
  1773. fmt::format("{} {two}", 1, fmt::arg("two", 2));
  1774. * Removed the write API in favor of the `format API
  1775. <https://fmt.dev/latest/api.html#format-api>`_ with compile-time handling of
  1776. format strings.
  1777. * Disallowed formatting of multibyte strings into a wide character target
  1778. (`#606 <https://github.com/fmtlib/fmt/pull/606>`_).
  1779. * Improved documentation
  1780. (`#515 <https://github.com/fmtlib/fmt/pull/515>`_,
  1781. `#614 <https://github.com/fmtlib/fmt/issues/614>`_,
  1782. `#617 <https://github.com/fmtlib/fmt/pull/617>`_,
  1783. `#661 <https://github.com/fmtlib/fmt/pull/661>`_,
  1784. `#680 <https://github.com/fmtlib/fmt/pull/680>`_).
  1785. Thanks `@ibell (Ian Bell) <https://github.com/ibell>`_,
  1786. `@mihaitodor (Mihai Todor) <https://github.com/mihaitodor>`_, and
  1787. `@johnthagen <https://github.com/johnthagen>`_.
  1788. * Implemented more efficient handling of large number of format arguments.
  1789. * Introduced an inline namespace for symbol versioning.
  1790. * Added debug postfix ``d`` to the ``fmt`` library name
  1791. (`#636 <https://github.com/fmtlib/fmt/issues/636>`_).
  1792. * Removed unnecessary ``fmt/`` prefix in includes
  1793. (`#397 <https://github.com/fmtlib/fmt/pull/397>`_).
  1794. Thanks `@chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>`_.
  1795. * Moved ``fmt/*.h`` to ``include/fmt/*.h`` to prevent irrelevant files and
  1796. directories appearing on the include search paths when fmt is used as a
  1797. subproject and moved source files to the ``src`` directory.
  1798. * Added qmake project file ``support/fmt.pro``
  1799. (`#641 <https://github.com/fmtlib/fmt/pull/641>`_).
  1800. Thanks `@cowo78 (Giuseppe Corbelli) <https://github.com/cowo78>`_.
  1801. * Added Gradle build file ``support/build.gradle``
  1802. (`#649 <https://github.com/fmtlib/fmt/pull/649>`_).
  1803. Thanks `@luncliff (Park DongHa) <https://github.com/luncliff>`_.
  1804. * Removed ``FMT_CPPFORMAT`` CMake option.
  1805. * Fixed a name conflict with the macro ``CHAR_WIDTH`` in glibc
  1806. (`#616 <https://github.com/fmtlib/fmt/pull/616>`_).
  1807. Thanks `@aroig (Abdó Roig-Maranges) <https://github.com/aroig>`_.
  1808. * Fixed handling of nested braces in ``fmt::join``
  1809. (`#638 <https://github.com/fmtlib/fmt/issues/638>`_).
  1810. * Added ``SOURCELINK_SUFFIX`` for compatibility with Sphinx 1.5
  1811. (`#497 <https://github.com/fmtlib/fmt/pull/497>`_).
  1812. Thanks `@ginggs (Graham Inggs) <https://github.com/ginggs>`_.
  1813. * Added a missing ``inline`` in the header-only mode
  1814. (`#626 <https://github.com/fmtlib/fmt/pull/626>`_).
  1815. Thanks `@aroig (Abdó Roig-Maranges) <https://github.com/aroig>`_.
  1816. * Fixed various compiler warnings
  1817. (`#640 <https://github.com/fmtlib/fmt/pull/640>`_,
  1818. `#656 <https://github.com/fmtlib/fmt/pull/656>`_,
  1819. `#679 <https://github.com/fmtlib/fmt/pull/679>`_,
  1820. `#681 <https://github.com/fmtlib/fmt/pull/681>`_,
  1821. `#705 <https://github.com/fmtlib/fmt/pull/705>`__,
  1822. `#715 <https://github.com/fmtlib/fmt/issues/715>`_,
  1823. `#717 <https://github.com/fmtlib/fmt/pull/717>`_,
  1824. `#720 <https://github.com/fmtlib/fmt/pull/720>`_,
  1825. `#723 <https://github.com/fmtlib/fmt/pull/723>`_,
  1826. `#726 <https://github.com/fmtlib/fmt/pull/726>`_,
  1827. `#730 <https://github.com/fmtlib/fmt/pull/730>`_,
  1828. `#739 <https://github.com/fmtlib/fmt/pull/739>`_).
  1829. Thanks `@peterbell10 <https://github.com/peterbell10>`_,
  1830. `@LarsGullik <https://github.com/LarsGullik>`_,
  1831. `@foonathan (Jonathan Müller) <https://github.com/foonathan>`_,
  1832. `@eliaskosunen (Elias Kosunen) <https://github.com/eliaskosunen>`_,
  1833. `@christianparpart (Christian Parpart) <https://github.com/christianparpart>`_,
  1834. `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_,
  1835. and `@mwinterb <https://github.com/mwinterb>`_.
  1836. * Worked around an MSVC bug and fixed several warnings
  1837. (`#653 <https://github.com/fmtlib/fmt/pull/653>`_).
  1838. Thanks `@alabuzhev (Alex Alabuzhev) <https://github.com/alabuzhev>`_.
  1839. * Worked around GCC bug 67371
  1840. (`#682 <https://github.com/fmtlib/fmt/issues/682>`_).
  1841. * Fixed compilation with ``-fno-exceptions``
  1842. (`#655 <https://github.com/fmtlib/fmt/pull/655>`_).
  1843. Thanks `@chenxiaolong (Andrew Gunnerson) <https://github.com/chenxiaolong>`_.
  1844. * Made ``constexpr remove_prefix`` gcc version check tighter
  1845. (`#648 <https://github.com/fmtlib/fmt/issues/648>`_).
  1846. * Renamed internal type enum constants to prevent collision with poorly written
  1847. C libraries (`#644 <https://github.com/fmtlib/fmt/issues/644>`_).
  1848. * Added detection of ``wostream operator<<``
  1849. (`#650 <https://github.com/fmtlib/fmt/issues/650>`_).
  1850. * Fixed compilation on OpenBSD
  1851. (`#660 <https://github.com/fmtlib/fmt/pull/660>`_).
  1852. Thanks `@hubslave <https://github.com/hubslave>`_.
  1853. * Fixed compilation on FreeBSD 12
  1854. (`#732 <https://github.com/fmtlib/fmt/pull/732>`_).
  1855. Thanks `@dankm <https://github.com/dankm>`_.
  1856. * Fixed compilation when there is a mismatch between ``-std`` options between
  1857. the library and user code
  1858. (`#664 <https://github.com/fmtlib/fmt/issues/664>`_).
  1859. * Fixed compilation with GCC 7 and ``-std=c++11``
  1860. (`#734 <https://github.com/fmtlib/fmt/issues/734>`_).
  1861. * Improved generated binary code on GCC 7 and older
  1862. (`#668 <https://github.com/fmtlib/fmt/issues/668>`_).
  1863. * Fixed handling of numeric alignment with no width
  1864. (`#675 <https://github.com/fmtlib/fmt/issues/675>`_).
  1865. * Fixed handling of empty strings in UTF8/16 converters
  1866. (`#676 <https://github.com/fmtlib/fmt/pull/676>`_).
  1867. Thanks `@vgalka-sl (Vasili Galka) <https://github.com/vgalka-sl>`_.
  1868. * Fixed formatting of an empty ``string_view``
  1869. (`#689 <https://github.com/fmtlib/fmt/issues/689>`_).
  1870. * Fixed detection of ``string_view`` on libc++
  1871. (`#686 <https://github.com/fmtlib/fmt/issues/686>`_).
  1872. * Fixed DLL issues (`#696 <https://github.com/fmtlib/fmt/pull/696>`_).
  1873. Thanks `@sebkoenig <https://github.com/sebkoenig>`_.
  1874. * Fixed compile checks for mixing narrow and wide strings
  1875. (`#690 <https://github.com/fmtlib/fmt/issues/690>`_).
  1876. * Disabled unsafe implicit conversion to ``std::string``
  1877. (`#729 <https://github.com/fmtlib/fmt/issues/729>`_).
  1878. * Fixed handling of reused format specs (as in ``fmt::join``) for pointers
  1879. (`#725 <https://github.com/fmtlib/fmt/pull/725>`_).
  1880. Thanks `@mwinterb <https://github.com/mwinterb>`_.
  1881. * Fixed installation of ``fmt/ranges.h``
  1882. (`#738 <https://github.com/fmtlib/fmt/pull/738>`_).
  1883. Thanks `@sv1990 <https://github.com/sv1990>`_.
  1884. 4.1.0 - 2017-12-20
  1885. ------------------
  1886. * Added ``fmt::to_wstring()`` in addition to ``fmt::to_string()``
  1887. (`#559 <https://github.com/fmtlib/fmt/pull/559>`_).
  1888. Thanks `@alabuzhev (Alex Alabuzhev) <https://github.com/alabuzhev>`_.
  1889. * Added support for C++17 ``std::string_view``
  1890. (`#571 <https://github.com/fmtlib/fmt/pull/571>`_ and
  1891. `#578 <https://github.com/fmtlib/fmt/pull/578>`_).
  1892. Thanks `@thelostt (Mário Feroldi) <https://github.com/thelostt>`_ and
  1893. `@mwinterb <https://github.com/mwinterb>`_.
  1894. * Enabled stream exceptions to catch errors
  1895. (`#581 <https://github.com/fmtlib/fmt/issues/581>`_).
  1896. Thanks `@crusader-mike <https://github.com/crusader-mike>`_.
  1897. * Allowed formatting of class hierarchies with ``fmt::format_arg()``
  1898. (`#547 <https://github.com/fmtlib/fmt/pull/547>`_).
  1899. Thanks `@rollbear (Björn Fahller) <https://github.com/rollbear>`_.
  1900. * Removed limitations on character types
  1901. (`#563 <https://github.com/fmtlib/fmt/pull/563>`_).
  1902. Thanks `@Yelnats321 (Elnar Dakeshov) <https://github.com/Yelnats321>`_.
  1903. * Conditionally enabled use of ``std::allocator_traits``
  1904. (`#583 <https://github.com/fmtlib/fmt/pull/583>`_).
  1905. Thanks `@mwinterb <https://github.com/mwinterb>`_.
  1906. * Added support for ``const`` variadic member function emulation with
  1907. ``FMT_VARIADIC_CONST`` (`#591 <https://github.com/fmtlib/fmt/pull/591>`_).
  1908. Thanks `@ludekvodicka (Ludek Vodicka) <https://github.com/ludekvodicka>`_.
  1909. * Various bugfixes: bad overflow check, unsupported implicit type conversion
  1910. when determining formatting function, test segfaults
  1911. (`#551 <https://github.com/fmtlib/fmt/issues/551>`_), ill-formed macros
  1912. (`#542 <https://github.com/fmtlib/fmt/pull/542>`_) and ambiguous overloads
  1913. (`#580 <https://github.com/fmtlib/fmt/issues/580>`_).
  1914. Thanks `@xylosper (Byoung-young Lee) <https://github.com/xylosper>`_.
  1915. * Prevented warnings on MSVC (`#605 <https://github.com/fmtlib/fmt/pull/605>`_,
  1916. `#602 <https://github.com/fmtlib/fmt/pull/602>`_, and
  1917. `#545 <https://github.com/fmtlib/fmt/pull/545>`_),
  1918. clang (`#582 <https://github.com/fmtlib/fmt/pull/582>`_),
  1919. GCC (`#573 <https://github.com/fmtlib/fmt/issues/573>`_),
  1920. various conversion warnings (`#609 <https://github.com/fmtlib/fmt/pull/609>`_,
  1921. `#567 <https://github.com/fmtlib/fmt/pull/567>`_,
  1922. `#553 <https://github.com/fmtlib/fmt/pull/553>`_ and
  1923. `#553 <https://github.com/fmtlib/fmt/pull/553>`_), and added ``override`` and
  1924. ``[[noreturn]]`` (`#549 <https://github.com/fmtlib/fmt/pull/549>`_ and
  1925. `#555 <https://github.com/fmtlib/fmt/issues/555>`_).
  1926. Thanks `@alabuzhev (Alex Alabuzhev) <https://github.com/alabuzhev>`_,
  1927. `@virgiliofornazin (Virgilio Alexandre Fornazin)
  1928. <https://gihtub.com/virgiliofornazin>`_,
  1929. `@alexanderbock (Alexander Bock) <https://github.com/alexanderbock>`_,
  1930. `@yumetodo <https://github.com/yumetodo>`_,
  1931. `@VaderY (Császár Mátyás) <https://github.com/VaderY>`_,
  1932. `@jpcima (JP Cimalando) <https://github.com/jpcima>`_,
  1933. `@thelostt (Mário Feroldi) <https://github.com/thelostt>`_, and
  1934. `@Manu343726 (Manu Sánchez) <https://github.com/Manu343726>`_.
  1935. * Improved CMake: Used ``GNUInstallDirs`` to set installation location
  1936. (`#610 <https://github.com/fmtlib/fmt/pull/610>`_) and fixed warnings
  1937. (`#536 <https://github.com/fmtlib/fmt/pull/536>`_ and
  1938. `#556 <https://github.com/fmtlib/fmt/pull/556>`_).
  1939. Thanks `@mikecrowe (Mike Crowe) <https://github.com/mikecrowe>`_,
  1940. `@evgen231 <https://github.com/evgen231>`_ and
  1941. `@henryiii (Henry Schreiner) <https://github.com/henryiii>`_.
  1942. 4.0.0 - 2017-06-27
  1943. ------------------
  1944. * Removed old compatibility headers ``cppformat/*.h`` and CMake options
  1945. (`#527 <https://github.com/fmtlib/fmt/pull/527>`_).
  1946. Thanks `@maddinat0r (Alex Martin) <https://github.com/maddinat0r>`_.
  1947. * Added ``string.h`` containing ``fmt::to_string()`` as alternative to
  1948. ``std::to_string()`` as well as other string writer functionality
  1949. (`#326 <https://github.com/fmtlib/fmt/issues/326>`_ and
  1950. `#441 <https://github.com/fmtlib/fmt/pull/441>`_):
  1951. .. code:: c++
  1952. #include "fmt/string.h"
  1953. std::string answer = fmt::to_string(42);
  1954. Thanks to `@glebov-andrey (Andrey Glebov)
  1955. <https://github.com/glebov-andrey>`_.
  1956. * Moved ``fmt::printf()`` to new ``printf.h`` header and allowed ``%s`` as
  1957. generic specifier (`#453 <https://github.com/fmtlib/fmt/pull/453>`_),
  1958. made ``%.f`` more conformant to regular ``printf()``
  1959. (`#490 <https://github.com/fmtlib/fmt/pull/490>`_), added custom writer
  1960. support (`#476 <https://github.com/fmtlib/fmt/issues/476>`_) and implemented
  1961. missing custom argument formatting
  1962. (`#339 <https://github.com/fmtlib/fmt/pull/339>`_ and
  1963. `#340 <https://github.com/fmtlib/fmt/pull/340>`_):
  1964. .. code:: c++
  1965. #include "fmt/printf.h"
  1966. // %s format specifier can be used with any argument type.
  1967. fmt::printf("%s", 42);
  1968. Thanks `@mojoBrendan <https://github.com/mojoBrendan>`_,
  1969. `@manylegged (Arthur Danskin) <https://github.com/manylegged>`_ and
  1970. `@spacemoose (Glen Stark) <https://github.com/spacemoose>`_.
  1971. See also `#360 <https://github.com/fmtlib/fmt/issues/360>`_,
  1972. `#335 <https://github.com/fmtlib/fmt/issues/335>`_ and
  1973. `#331 <https://github.com/fmtlib/fmt/issues/331>`_.
  1974. * Added ``container.h`` containing a ``BasicContainerWriter``
  1975. to write to containers like ``std::vector``
  1976. (`#450 <https://github.com/fmtlib/fmt/pull/450>`_).
  1977. Thanks `@polyvertex (Jean-Charles Lefebvre) <https://github.com/polyvertex>`_.
  1978. * Added ``fmt::join()`` function that takes a range and formats
  1979. its elements separated by a given string
  1980. (`#466 <https://github.com/fmtlib/fmt/pull/466>`_):
  1981. .. code:: c++
  1982. #include "fmt/format.h"
  1983. std::vector<double> v = {1.2, 3.4, 5.6};
  1984. // Prints "(+01.20, +03.40, +05.60)".
  1985. fmt::print("({:+06.2f})", fmt::join(v.begin(), v.end(), ", "));
  1986. Thanks `@olivier80 <https://github.com/olivier80>`_.
  1987. * Added support for custom formatting specifications to simplify customization
  1988. of built-in formatting (`#444 <https://github.com/fmtlib/fmt/pull/444>`_).
  1989. Thanks `@polyvertex (Jean-Charles Lefebvre) <https://github.com/polyvertex>`_.
  1990. See also `#439 <https://github.com/fmtlib/fmt/issues/439>`_.
  1991. * Added ``fmt::format_system_error()`` for error code formatting
  1992. (`#323 <https://github.com/fmtlib/fmt/issues/323>`_ and
  1993. `#526 <https://github.com/fmtlib/fmt/pull/526>`_).
  1994. Thanks `@maddinat0r (Alex Martin) <https://github.com/maddinat0r>`_.
  1995. * Added thread-safe ``fmt::localtime()`` and ``fmt::gmtime()``
  1996. as replacement for the standard version to ``time.h``
  1997. (`#396 <https://github.com/fmtlib/fmt/pull/396>`_).
  1998. Thanks `@codicodi <https://github.com/codicodi>`_.
  1999. * Internal improvements to ``NamedArg`` and ``ArgLists``
  2000. (`#389 <https://github.com/fmtlib/fmt/pull/389>`_ and
  2001. `#390 <https://github.com/fmtlib/fmt/pull/390>`_).
  2002. Thanks `@chronoxor <https://github.com/chronoxor>`_.
  2003. * Fixed crash due to bug in ``FormatBuf``
  2004. (`#493 <https://github.com/fmtlib/fmt/pull/493>`_).
  2005. Thanks `@effzeh <https://github.com/effzeh>`_. See also
  2006. `#480 <https://github.com/fmtlib/fmt/issues/480>`_ and
  2007. `#491 <https://github.com/fmtlib/fmt/issues/491>`_.
  2008. * Fixed handling of wide strings in ``fmt::StringWriter``.
  2009. * Improved compiler error messages
  2010. (`#357 <https://github.com/fmtlib/fmt/issues/357>`_).
  2011. * Fixed various warnings and issues with various compilers
  2012. (`#494 <https://github.com/fmtlib/fmt/pull/494>`_,
  2013. `#499 <https://github.com/fmtlib/fmt/pull/499>`_,
  2014. `#483 <https://github.com/fmtlib/fmt/pull/483>`_,
  2015. `#485 <https://github.com/fmtlib/fmt/pull/485>`_,
  2016. `#482 <https://github.com/fmtlib/fmt/pull/482>`_,
  2017. `#475 <https://github.com/fmtlib/fmt/pull/475>`_,
  2018. `#473 <https://github.com/fmtlib/fmt/pull/473>`_ and
  2019. `#414 <https://github.com/fmtlib/fmt/pull/414>`_).
  2020. Thanks `@chronoxor <https://github.com/chronoxor>`_,
  2021. `@zhaohuaxishi <https://github.com/zhaohuaxishi>`_,
  2022. `@pkestene (Pierre Kestener) <https://github.com/pkestene>`_,
  2023. `@dschmidt (Dominik Schmidt) <https://github.com/dschmidt>`_ and
  2024. `@0x414c (Alexey Gorishny) <https://github.com/0x414c>`_ .
  2025. * Improved CMake: targets are now namespaced
  2026. (`#511 <https://github.com/fmtlib/fmt/pull/511>`_ and
  2027. `#513 <https://github.com/fmtlib/fmt/pull/513>`_), supported header-only
  2028. ``printf.h`` (`#354 <https://github.com/fmtlib/fmt/pull/354>`_), fixed issue
  2029. with minimal supported library subset
  2030. (`#418 <https://github.com/fmtlib/fmt/issues/418>`_,
  2031. `#419 <https://github.com/fmtlib/fmt/pull/419>`_ and
  2032. `#420 <https://github.com/fmtlib/fmt/pull/420>`_).
  2033. Thanks `@bjoernthiel (Bjoern Thiel) <https://github.com/bjoernthiel>`_,
  2034. `@niosHD (Mario Werner) <https://github.com/niosHD>`_,
  2035. `@LogicalKnight (Sean LK) <https://github.com/LogicalKnight>`_ and
  2036. `@alabuzhev (Alex Alabuzhev) <https://github.com/alabuzhev>`_.
  2037. * Improved documentation. Thanks to
  2038. `@pwm1234 (Phil) <https://github.com/pwm1234>`_ for
  2039. `#393 <https://github.com/fmtlib/fmt/pull/393>`_.
  2040. 3.0.2 - 2017-06-14
  2041. ------------------
  2042. * Added ``FMT_VERSION`` macro
  2043. (`#411 <https://github.com/fmtlib/fmt/issues/411>`_).
  2044. * Used ``FMT_NULL`` instead of literal ``0``
  2045. (`#409 <https://github.com/fmtlib/fmt/pull/409>`_).
  2046. Thanks `@alabuzhev (Alex Alabuzhev) <https://github.com/alabuzhev>`_.
  2047. * Added extern templates for ``format_float``
  2048. (`#413 <https://github.com/fmtlib/fmt/issues/413>`_).
  2049. * Fixed implicit conversion issue
  2050. (`#507 <https://github.com/fmtlib/fmt/issues/507>`_).
  2051. * Fixed signbit detection (`#423 <https://github.com/fmtlib/fmt/issues/423>`_).
  2052. * Fixed naming collision (`#425 <https://github.com/fmtlib/fmt/issues/425>`_).
  2053. * Fixed missing intrinsic for C++/CLI
  2054. (`#457 <https://github.com/fmtlib/fmt/pull/457>`_).
  2055. Thanks `@calumr (Calum Robinson) <https://github.com/calumr>`_
  2056. * Fixed Android detection (`#458 <https://github.com/fmtlib/fmt/pull/458>`_).
  2057. Thanks `@Gachapen (Magnus Bjerke Vik) <https://github.com/Gachapen>`_.
  2058. * Use lean ``windows.h`` if not in header-only mode
  2059. (`#503 <https://github.com/fmtlib/fmt/pull/503>`_).
  2060. Thanks `@Quentin01 (Quentin Buathier) <https://github.com/Quentin01>`_.
  2061. * Fixed issue with CMake exporting C++11 flag
  2062. (`#445 <https://github.com/fmtlib/fmt/pull/455>`_).
  2063. Thanks `@EricWF (Eric) <https://github.com/EricWF>`_.
  2064. * Fixed issue with nvcc and MSVC compiler bug and MinGW
  2065. (`#505 <https://github.com/fmtlib/fmt/issues/505>`_).
  2066. * Fixed DLL issues (`#469 <https://github.com/fmtlib/fmt/pull/469>`_ and
  2067. `#502 <https://github.com/fmtlib/fmt/pull/502>`_).
  2068. Thanks `@richardeakin (Richard Eakin) <https://github.com/richardeakin>`_ and
  2069. `@AndreasSchoenle (Andreas Schönle) <https://github.com/AndreasSchoenle>`_.
  2070. * Fixed test compilation under FreeBSD
  2071. (`#433 <https://github.com/fmtlib/fmt/issues/433>`_).
  2072. * Fixed various warnings (`#403 <https://github.com/fmtlib/fmt/pull/403>`_,
  2073. `#410 <https://github.com/fmtlib/fmt/pull/410>`_ and
  2074. `#510 <https://github.com/fmtlib/fmt/pull/510>`_).
  2075. Thanks `@Lecetem <https://github.com/Lectem>`_,
  2076. `@chenhayat (Chen Hayat) <https://github.com/chenhayat>`_ and
  2077. `@trozen <https://github.com/trozen>`_.
  2078. * Worked around a broken ``__builtin_clz`` in clang with MS codegen
  2079. (`#519 <https://github.com/fmtlib/fmt/issues/519>`_).
  2080. * Removed redundant include
  2081. (`#479 <https://github.com/fmtlib/fmt/issues/479>`_).
  2082. * Fixed documentation issues.
  2083. 3.0.1 - 2016-11-01
  2084. ------------------
  2085. * Fixed handling of thousands separator
  2086. (`#353 <https://github.com/fmtlib/fmt/issues/353>`_).
  2087. * Fixed handling of ``unsigned char`` strings
  2088. (`#373 <https://github.com/fmtlib/fmt/issues/373>`_).
  2089. * Corrected buffer growth when formatting time
  2090. (`#367 <https://github.com/fmtlib/fmt/issues/367>`_).
  2091. * Removed warnings under MSVC and clang
  2092. (`#318 <https://github.com/fmtlib/fmt/issues/318>`_,
  2093. `#250 <https://github.com/fmtlib/fmt/issues/250>`_, also merged
  2094. `#385 <https://github.com/fmtlib/fmt/pull/385>`_ and
  2095. `#361 <https://github.com/fmtlib/fmt/pull/361>`_).
  2096. Thanks `@jcelerier (Jean-Michaël Celerier) <https://github.com/jcelerier>`_
  2097. and `@nmoehrle (Nils Moehrle) <https://github.com/nmoehrle>`_.
  2098. * Fixed compilation issues under Android
  2099. (`#327 <https://github.com/fmtlib/fmt/pull/327>`_,
  2100. `#345 <https://github.com/fmtlib/fmt/issues/345>`_ and
  2101. `#381 <https://github.com/fmtlib/fmt/pull/381>`_),
  2102. FreeBSD (`#358 <https://github.com/fmtlib/fmt/pull/358>`_),
  2103. Cygwin (`#388 <https://github.com/fmtlib/fmt/issues/388>`_),
  2104. MinGW (`#355 <https://github.com/fmtlib/fmt/issues/355>`_) as well as other
  2105. issues (`#350 <https://github.com/fmtlib/fmt/issues/350>`_,
  2106. `#366 <https://github.com/fmtlib/fmt/issues/355>`_,
  2107. `#348 <https://github.com/fmtlib/fmt/pull/348>`_,
  2108. `#402 <https://github.com/fmtlib/fmt/pull/402>`_,
  2109. `#405 <https://github.com/fmtlib/fmt/pull/405>`_).
  2110. Thanks to `@dpantele (Dmitry) <https://github.com/dpantele>`_,
  2111. `@hghwng (Hugh Wang) <https://github.com/hghwng>`_,
  2112. `@arvedarved (Tilman Keskinöz) <https://github.com/arvedarved>`_,
  2113. `@LogicalKnight (Sean) <https://github.com/LogicalKnight>`_ and
  2114. `@JanHellwig (Jan Hellwig) <https://github.com/janhellwig>`_.
  2115. * Fixed some documentation issues and extended specification
  2116. (`#320 <https://github.com/fmtlib/fmt/issues/320>`_,
  2117. `#333 <https://github.com/fmtlib/fmt/pull/333>`_,
  2118. `#347 <https://github.com/fmtlib/fmt/issues/347>`_,
  2119. `#362 <https://github.com/fmtlib/fmt/pull/362>`_).
  2120. Thanks to `@smellman (Taro Matsuzawa aka. btm)
  2121. <https://github.com/smellman>`_.
  2122. 3.0.0 - 2016-05-07
  2123. ------------------
  2124. * The project has been renamed from C++ Format (cppformat) to fmt for
  2125. consistency with the used namespace and macro prefix
  2126. (`#307 <https://github.com/fmtlib/fmt/issues/307>`_).
  2127. Library headers are now located in the ``fmt`` directory:
  2128. .. code:: c++
  2129. #include "fmt/format.h"
  2130. Including ``format.h`` from the ``cppformat`` directory is deprecated
  2131. but works via a proxy header which will be removed in the next major version.
  2132. The documentation is now available at https://fmt.dev.
  2133. * Added support for `strftime <http://en.cppreference.com/w/cpp/chrono/c/strftime>`_-like
  2134. `date and time formatting <https://fmt.dev/3.0.0/api.html#date-and-time-formatting>`_
  2135. (`#283 <https://github.com/fmtlib/fmt/issues/283>`_):
  2136. .. code:: c++
  2137. #include "fmt/time.h"
  2138. std::time_t t = std::time(nullptr);
  2139. // Prints "The date is 2016-04-29." (with the current date)
  2140. fmt::print("The date is {:%Y-%m-%d}.", *std::localtime(&t));
  2141. * ``std::ostream`` support including formatting of user-defined types that provide
  2142. overloaded ``operator<<`` has been moved to ``fmt/ostream.h``:
  2143. .. code:: c++
  2144. #include "fmt/ostream.h"
  2145. class Date {
  2146. int year_, month_, day_;
  2147. public:
  2148. Date(int year, int month, int day) : year_(year), month_(month), day_(day) {}
  2149. friend std::ostream &operator<<(std::ostream &os, const Date &d) {
  2150. return os << d.year_ << '-' << d.month_ << '-' << d.day_;
  2151. }
  2152. };
  2153. std::string s = fmt::format("The date is {}", Date(2012, 12, 9));
  2154. // s == "The date is 2012-12-9"
  2155. * Added support for `custom argument formatters
  2156. <https://fmt.dev/3.0.0/api.html#argument-formatters>`_
  2157. (`#235 <https://github.com/fmtlib/fmt/issues/235>`_).
  2158. * Added support for locale-specific integer formatting with the ``n`` specifier
  2159. (`#305 <https://github.com/fmtlib/fmt/issues/305>`_):
  2160. .. code:: c++
  2161. std::setlocale(LC_ALL, "en_US.utf8");
  2162. fmt::print("cppformat: {:n}\n", 1234567); // prints 1,234,567
  2163. * Sign is now preserved when formatting an integer with an incorrect ``printf``
  2164. format specifier (`#265 <https://github.com/fmtlib/fmt/issues/265>`_):
  2165. .. code:: c++
  2166. fmt::printf("%lld", -42); // prints -42
  2167. Note that it would be an undefined behavior in ``std::printf``.
  2168. * Length modifiers such as ``ll`` are now optional in printf formatting
  2169. functions and the correct type is determined automatically
  2170. (`#255 <https://github.com/fmtlib/fmt/issues/255>`_):
  2171. .. code:: c++
  2172. fmt::printf("%d", std::numeric_limits<long long>::max());
  2173. Note that it would be an undefined behavior in ``std::printf``.
  2174. * Added initial support for custom formatters
  2175. (`#231 <https://github.com/fmtlib/fmt/issues/231>`_).
  2176. * Fixed detection of user-defined literal support on Intel C++ compiler
  2177. (`#311 <https://github.com/fmtlib/fmt/issues/311>`_,
  2178. `#312 <https://github.com/fmtlib/fmt/pull/312>`_).
  2179. Thanks to `@dean0x7d (Dean Moldovan) <https://github.com/dean0x7d>`_ and
  2180. `@speth (Ray Speth) <https://github.com/speth>`_.
  2181. * Reduced compile time
  2182. (`#243 <https://github.com/fmtlib/fmt/pull/243>`_,
  2183. `#249 <https://github.com/fmtlib/fmt/pull/249>`_,
  2184. `#317 <https://github.com/fmtlib/fmt/issues/317>`_):
  2185. .. image:: https://cloud.githubusercontent.com/assets/4831417/11614060/
  2186. b9e826d2-9c36-11e5-8666-d4131bf503ef.png
  2187. .. image:: https://cloud.githubusercontent.com/assets/4831417/11614080/
  2188. 6ac903cc-9c37-11e5-8165-26df6efae364.png
  2189. Thanks to `@dean0x7d (Dean Moldovan) <https://github.com/dean0x7d>`_.
  2190. * Compile test fixes (`#313 <https://github.com/fmtlib/fmt/pull/313>`_).
  2191. Thanks to `@dean0x7d (Dean Moldovan) <https://github.com/dean0x7d>`_.
  2192. * Documentation fixes (`#239 <https://github.com/fmtlib/fmt/pull/239>`_,
  2193. `#248 <https://github.com/fmtlib/fmt/issues/248>`_,
  2194. `#252 <https://github.com/fmtlib/fmt/issues/252>`_,
  2195. `#258 <https://github.com/fmtlib/fmt/pull/258>`_,
  2196. `#260 <https://github.com/fmtlib/fmt/issues/260>`_,
  2197. `#301 <https://github.com/fmtlib/fmt/issues/301>`_,
  2198. `#309 <https://github.com/fmtlib/fmt/pull/309>`_).
  2199. Thanks to `@ReadmeCritic <https://github.com/ReadmeCritic>`_
  2200. `@Gachapen (Magnus Bjerke Vik) <https://github.com/Gachapen>`_ and
  2201. `@jwilk (Jakub Wilk) <https://github.com/jwilk>`_.
  2202. * Fixed compiler and sanitizer warnings
  2203. (`#244 <https://github.com/fmtlib/fmt/issues/244>`_,
  2204. `#256 <https://github.com/fmtlib/fmt/pull/256>`_,
  2205. `#259 <https://github.com/fmtlib/fmt/pull/259>`_,
  2206. `#263 <https://github.com/fmtlib/fmt/issues/263>`_,
  2207. `#274 <https://github.com/fmtlib/fmt/issues/274>`_,
  2208. `#277 <https://github.com/fmtlib/fmt/pull/277>`_,
  2209. `#286 <https://github.com/fmtlib/fmt/pull/286>`_,
  2210. `#291 <https://github.com/fmtlib/fmt/issues/291>`_,
  2211. `#296 <https://github.com/fmtlib/fmt/issues/296>`_,
  2212. `#308 <https://github.com/fmtlib/fmt/issues/308>`_)
  2213. Thanks to `@mwinterb <https://github.com/mwinterb>`_,
  2214. `@pweiskircher (Patrik Weiskircher) <https://github.com/pweiskircher>`_,
  2215. `@Naios <https://github.com/Naios>`_.
  2216. * Improved compatibility with Windows Store apps
  2217. (`#280 <https://github.com/fmtlib/fmt/issues/280>`_,
  2218. `#285 <https://github.com/fmtlib/fmt/pull/285>`_)
  2219. Thanks to `@mwinterb <https://github.com/mwinterb>`_.
  2220. * Added tests of compatibility with older C++ standards
  2221. (`#273 <https://github.com/fmtlib/fmt/pull/273>`_).
  2222. Thanks to `@niosHD <https://github.com/niosHD>`_.
  2223. * Fixed Android build (`#271 <https://github.com/fmtlib/fmt/pull/271>`_).
  2224. Thanks to `@newnon <https://github.com/newnon>`_.
  2225. * Changed ``ArgMap`` to be backed by a vector instead of a map.
  2226. (`#261 <https://github.com/fmtlib/fmt/issues/261>`_,
  2227. `#262 <https://github.com/fmtlib/fmt/pull/262>`_).
  2228. Thanks to `@mwinterb <https://github.com/mwinterb>`_.
  2229. * Added ``fprintf`` overload that writes to a ``std::ostream``
  2230. (`#251 <https://github.com/fmtlib/fmt/pull/251>`_).
  2231. Thanks to `nickhutchinson (Nicholas Hutchinson) <https://github.com/nickhutchinson>`_.
  2232. * Export symbols when building a Windows DLL
  2233. (`#245 <https://github.com/fmtlib/fmt/pull/245>`_).
  2234. Thanks to `macdems (Maciek Dems) <https://github.com/macdems>`_.
  2235. * Fixed compilation on Cygwin (`#304 <https://github.com/fmtlib/fmt/issues/304>`_).
  2236. * Implemented a workaround for a bug in Apple LLVM version 4.2 of clang
  2237. (`#276 <https://github.com/fmtlib/fmt/issues/276>`_).
  2238. * Implemented a workaround for Google Test bug
  2239. `#705 <https://github.com/google/googletest/issues/705>`_ on gcc 6
  2240. (`#268 <https://github.com/fmtlib/fmt/issues/268>`_).
  2241. Thanks to `octoploid <https://github.com/octoploid>`_.
  2242. * Removed Biicode support because the latter has been discontinued.
  2243. 2.1.1 - 2016-04-11
  2244. ------------------
  2245. * The install location for generated CMake files is now configurable via
  2246. the ``FMT_CMAKE_DIR`` CMake variable
  2247. (`#299 <https://github.com/fmtlib/fmt/pull/299>`_).
  2248. Thanks to `@niosHD <https://github.com/niosHD>`_.
  2249. * Documentation fixes (`#252 <https://github.com/fmtlib/fmt/issues/252>`_).
  2250. 2.1.0 - 2016-03-21
  2251. ------------------
  2252. * Project layout and build system improvements
  2253. (`#267 <https://github.com/fmtlib/fmt/pull/267>`_):
  2254. * The code have been moved to the ``cppformat`` directory.
  2255. Including ``format.h`` from the top-level directory is deprecated
  2256. but works via a proxy header which will be removed in the next
  2257. major version.
  2258. * C++ Format CMake targets now have proper interface definitions.
  2259. * Installed version of the library now supports the header-only
  2260. configuration.
  2261. * Targets ``doc``, ``install``, and ``test`` are now disabled if C++ Format
  2262. is included as a CMake subproject. They can be enabled by setting
  2263. ``FMT_DOC``, ``FMT_INSTALL``, and ``FMT_TEST`` in the parent project.
  2264. Thanks to `@niosHD <https://github.com/niosHD>`_.
  2265. 2.0.1 - 2016-03-13
  2266. ------------------
  2267. * Improved CMake find and package support
  2268. (`#264 <https://github.com/fmtlib/fmt/issues/264>`_).
  2269. Thanks to `@niosHD <https://github.com/niosHD>`_.
  2270. * Fix compile error with Android NDK and mingw32
  2271. (`#241 <https://github.com/fmtlib/fmt/issues/241>`_).
  2272. Thanks to `@Gachapen (Magnus Bjerke Vik) <https://github.com/Gachapen>`_.
  2273. * Documentation fixes
  2274. (`#248 <https://github.com/fmtlib/fmt/issues/248>`_,
  2275. `#260 <https://github.com/fmtlib/fmt/issues/260>`_).
  2276. 2.0.0 - 2015-12-01
  2277. ------------------
  2278. General
  2279. ~~~~~~~
  2280. * [Breaking] Named arguments
  2281. (`#169 <https://github.com/fmtlib/fmt/pull/169>`_,
  2282. `#173 <https://github.com/fmtlib/fmt/pull/173>`_,
  2283. `#174 <https://github.com/fmtlib/fmt/pull/174>`_):
  2284. .. code:: c++
  2285. fmt::print("The answer is {answer}.", fmt::arg("answer", 42));
  2286. Thanks to `@jamboree <https://github.com/jamboree>`_.
  2287. * [Experimental] User-defined literals for format and named arguments
  2288. (`#204 <https://github.com/fmtlib/fmt/pull/204>`_,
  2289. `#206 <https://github.com/fmtlib/fmt/pull/206>`_,
  2290. `#207 <https://github.com/fmtlib/fmt/pull/207>`_):
  2291. .. code:: c++
  2292. using namespace fmt::literals;
  2293. fmt::print("The answer is {answer}.", "answer"_a=42);
  2294. Thanks to `@dean0x7d (Dean Moldovan) <https://github.com/dean0x7d>`_.
  2295. * [Breaking] Formatting of more than 16 arguments is now supported when using
  2296. variadic templates
  2297. (`#141 <https://github.com/fmtlib/fmt/issues/141>`_).
  2298. Thanks to `@Shauren <https://github.com/Shauren>`_.
  2299. * Runtime width specification
  2300. (`#168 <https://github.com/fmtlib/fmt/pull/168>`_):
  2301. .. code:: c++
  2302. fmt::format("{0:{1}}", 42, 5); // gives " 42"
  2303. Thanks to `@jamboree <https://github.com/jamboree>`_.
  2304. * [Breaking] Enums are now formatted with an overloaded ``std::ostream`` insertion
  2305. operator (``operator<<``) if available
  2306. (`#232 <https://github.com/fmtlib/fmt/issues/232>`_).
  2307. * [Breaking] Changed default ``bool`` format to textual, "true" or "false"
  2308. (`#170 <https://github.com/fmtlib/fmt/issues/170>`_):
  2309. .. code:: c++
  2310. fmt::print("{}", true); // prints "true"
  2311. To print ``bool`` as a number use numeric format specifier such as ``d``:
  2312. .. code:: c++
  2313. fmt::print("{:d}", true); // prints "1"
  2314. * ``fmt::printf`` and ``fmt::sprintf`` now support formatting of ``bool`` with the
  2315. ``%s`` specifier giving textual output, "true" or "false"
  2316. (`#223 <https://github.com/fmtlib/fmt/pull/223>`_):
  2317. .. code:: c++
  2318. fmt::printf("%s", true); // prints "true"
  2319. Thanks to `@LarsGullik <https://github.com/LarsGullik>`_.
  2320. * [Breaking] ``signed char`` and ``unsigned char`` are now formatted as integers by default
  2321. (`#217 <https://github.com/fmtlib/fmt/pull/217>`_).
  2322. * [Breaking] Pointers to C strings can now be formatted with the ``p`` specifier
  2323. (`#223 <https://github.com/fmtlib/fmt/pull/223>`_):
  2324. .. code:: c++
  2325. fmt::print("{:p}", "test"); // prints pointer value
  2326. Thanks to `@LarsGullik <https://github.com/LarsGullik>`_.
  2327. * [Breaking] ``fmt::printf`` and ``fmt::sprintf`` now print null pointers as ``(nil)``
  2328. and null strings as ``(null)`` for consistency with glibc
  2329. (`#226 <https://github.com/fmtlib/fmt/pull/226>`_).
  2330. Thanks to `@LarsGullik <https://github.com/LarsGullik>`_.
  2331. * [Breaking] ``fmt::(s)printf`` now supports formatting of objects of user-defined types
  2332. that provide an overloaded ``std::ostream`` insertion operator (``operator<<``)
  2333. (`#201 <https://github.com/fmtlib/fmt/issues/201>`_):
  2334. .. code:: c++
  2335. fmt::printf("The date is %s", Date(2012, 12, 9));
  2336. * [Breaking] The ``Buffer`` template is now part of the public API and can be used
  2337. to implement custom memory buffers
  2338. (`#140 <https://github.com/fmtlib/fmt/issues/140>`_).
  2339. Thanks to `@polyvertex (Jean-Charles Lefebvre) <https://github.com/polyvertex>`_.
  2340. * [Breaking] Improved compatibility between ``BasicStringRef`` and
  2341. `std::experimental::basic_string_view
  2342. <http://en.cppreference.com/w/cpp/experimental/basic_string_view>`_
  2343. (`#100 <https://github.com/fmtlib/fmt/issues/100>`_,
  2344. `#159 <https://github.com/fmtlib/fmt/issues/159>`_,
  2345. `#183 <https://github.com/fmtlib/fmt/issues/183>`_):
  2346. - Comparison operators now compare string content, not pointers
  2347. - ``BasicStringRef::c_str`` replaced by ``BasicStringRef::data``
  2348. - ``BasicStringRef`` is no longer assumed to be null-terminated
  2349. References to null-terminated strings are now represented by a new class,
  2350. ``BasicCStringRef``.
  2351. * Dependency on pthreads introduced by Google Test is now optional
  2352. (`#185 <https://github.com/fmtlib/fmt/issues/185>`_).
  2353. * New CMake options ``FMT_DOC``, ``FMT_INSTALL`` and ``FMT_TEST`` to control
  2354. generation of ``doc``, ``install`` and ``test`` targets respectively, on by default
  2355. (`#197 <https://github.com/fmtlib/fmt/issues/197>`_,
  2356. `#198 <https://github.com/fmtlib/fmt/issues/198>`_,
  2357. `#200 <https://github.com/fmtlib/fmt/issues/200>`_).
  2358. Thanks to `@maddinat0r (Alex Martin) <https://github.com/maddinat0r>`_.
  2359. * ``noexcept`` is now used when compiling with MSVC2015
  2360. (`#215 <https://github.com/fmtlib/fmt/pull/215>`_).
  2361. Thanks to `@dmkrepo (Dmitriy) <https://github.com/dmkrepo>`_.
  2362. * Added an option to disable use of ``windows.h`` when ``FMT_USE_WINDOWS_H``
  2363. is defined as 0 before including ``format.h``
  2364. (`#171 <https://github.com/fmtlib/fmt/issues/171>`_).
  2365. Thanks to `@alfps (Alf P. Steinbach) <https://github.com/alfps>`_.
  2366. * [Breaking] ``windows.h`` is now included with ``NOMINMAX`` unless
  2367. ``FMT_WIN_MINMAX`` is defined. This is done to prevent breaking code using
  2368. ``std::min`` and ``std::max`` and only affects the header-only configuration
  2369. (`#152 <https://github.com/fmtlib/fmt/issues/152>`_,
  2370. `#153 <https://github.com/fmtlib/fmt/pull/153>`_,
  2371. `#154 <https://github.com/fmtlib/fmt/pull/154>`_).
  2372. Thanks to `@DevO2012 <https://github.com/DevO2012>`_.
  2373. * Improved support for custom character types
  2374. (`#171 <https://github.com/fmtlib/fmt/issues/171>`_).
  2375. Thanks to `@alfps (Alf P. Steinbach) <https://github.com/alfps>`_.
  2376. * Added an option to disable use of IOStreams when ``FMT_USE_IOSTREAMS``
  2377. is defined as 0 before including ``format.h``
  2378. (`#205 <https://github.com/fmtlib/fmt/issues/205>`_,
  2379. `#208 <https://github.com/fmtlib/fmt/pull/208>`_).
  2380. Thanks to `@JodiTheTigger <https://github.com/JodiTheTigger>`_.
  2381. * Improved detection of ``isnan``, ``isinf`` and ``signbit``.
  2382. Optimization
  2383. ~~~~~~~~~~~~
  2384. * Made formatting of user-defined types more efficient with a custom stream buffer
  2385. (`#92 <https://github.com/fmtlib/fmt/issues/92>`_,
  2386. `#230 <https://github.com/fmtlib/fmt/pull/230>`_).
  2387. Thanks to `@NotImplemented <https://github.com/NotImplemented>`_.
  2388. * Further improved performance of ``fmt::Writer`` on integer formatting
  2389. and fixed a minor regression. Now it is ~7% faster than ``karma::generate``
  2390. on Karma's benchmark
  2391. (`#186 <https://github.com/fmtlib/fmt/issues/186>`_).
  2392. * [Breaking] Reduced `compiled code size
  2393. <https://github.com/fmtlib/fmt#compile-time-and-code-bloat>`_
  2394. (`#143 <https://github.com/fmtlib/fmt/issues/143>`_,
  2395. `#149 <https://github.com/fmtlib/fmt/pull/149>`_).
  2396. Distribution
  2397. ~~~~~~~~~~~~
  2398. * [Breaking] Headers are now installed in
  2399. ``${CMAKE_INSTALL_PREFIX}/include/cppformat``
  2400. (`#178 <https://github.com/fmtlib/fmt/issues/178>`_).
  2401. Thanks to `@jackyf (Eugene V. Lyubimkin) <https://github.com/jackyf>`_.
  2402. * [Breaking] Changed the library name from ``format`` to ``cppformat``
  2403. for consistency with the project name and to avoid potential conflicts
  2404. (`#178 <https://github.com/fmtlib/fmt/issues/178>`_).
  2405. Thanks to `@jackyf (Eugene V. Lyubimkin) <https://github.com/jackyf>`_.
  2406. * C++ Format is now available in `Debian <https://www.debian.org/>`_ GNU/Linux
  2407. (`stretch <https://packages.debian.org/source/stretch/cppformat>`_,
  2408. `sid <https://packages.debian.org/source/sid/cppformat>`_) and
  2409. derived distributions such as
  2410. `Ubuntu <https://launchpad.net/ubuntu/+source/cppformat>`_ 15.10 and later
  2411. (`#155 <https://github.com/fmtlib/fmt/issues/155>`_)::
  2412. $ sudo apt-get install libcppformat1-dev
  2413. Thanks to `@jackyf (Eugene V. Lyubimkin) <https://github.com/jackyf>`_.
  2414. * `Packages for Fedora and RHEL <https://admin.fedoraproject.org/pkgdb/package/cppformat/>`_
  2415. are now available. Thanks to Dave Johansen.
  2416. * C++ Format can now be installed via `Homebrew <http://brew.sh/>`_ on OS X
  2417. (`#157 <https://github.com/fmtlib/fmt/issues/157>`_)::
  2418. $ brew install cppformat
  2419. Thanks to `@ortho <https://github.com/ortho>`_, Anatoliy Bulukin.
  2420. Documentation
  2421. ~~~~~~~~~~~~~
  2422. * Migrated from ReadTheDocs to GitHub Pages for better responsiveness
  2423. and reliability
  2424. (`#128 <https://github.com/fmtlib/fmt/issues/128>`_).
  2425. New documentation address is http://cppformat.github.io/.
  2426. * Added `Building the documentation
  2427. <https://fmt.dev/2.0.0/usage.html#building-the-documentation>`_
  2428. section to the documentation.
  2429. * Documentation build script is now compatible with Python 3 and newer pip versions.
  2430. (`#189 <https://github.com/fmtlib/fmt/pull/189>`_,
  2431. `#209 <https://github.com/fmtlib/fmt/issues/209>`_).
  2432. Thanks to `@JodiTheTigger <https://github.com/JodiTheTigger>`_ and
  2433. `@xentec <https://github.com/xentec>`_.
  2434. * Documentation fixes and improvements
  2435. (`#36 <https://github.com/fmtlib/fmt/issues/36>`_,
  2436. `#75 <https://github.com/fmtlib/fmt/issues/75>`_,
  2437. `#125 <https://github.com/fmtlib/fmt/issues/125>`_,
  2438. `#160 <https://github.com/fmtlib/fmt/pull/160>`_,
  2439. `#161 <https://github.com/fmtlib/fmt/pull/161>`_,
  2440. `#162 <https://github.com/fmtlib/fmt/issues/162>`_,
  2441. `#165 <https://github.com/fmtlib/fmt/issues/165>`_,
  2442. `#210 <https://github.com/fmtlib/fmt/issues/210>`_).
  2443. Thanks to `@syohex (Syohei YOSHIDA) <https://github.com/syohex>`_ and
  2444. bug reporters.
  2445. * Fixed out-of-tree documentation build
  2446. (`#177 <https://github.com/fmtlib/fmt/issues/177>`_).
  2447. Thanks to `@jackyf (Eugene V. Lyubimkin) <https://github.com/jackyf>`_.
  2448. Fixes
  2449. ~~~~~
  2450. * Fixed ``initializer_list`` detection
  2451. (`#136 <https://github.com/fmtlib/fmt/issues/136>`_).
  2452. Thanks to `@Gachapen (Magnus Bjerke Vik) <https://github.com/Gachapen>`_.
  2453. * [Breaking] Fixed formatting of enums with numeric format specifiers in
  2454. ``fmt::(s)printf``
  2455. (`#131 <https://github.com/fmtlib/fmt/issues/131>`_,
  2456. `#139 <https://github.com/fmtlib/fmt/issues/139>`_):
  2457. .. code:: c++
  2458. enum { ANSWER = 42 };
  2459. fmt::printf("%d", ANSWER);
  2460. Thanks to `@Naios <https://github.com/Naios>`_.
  2461. * Improved compatibility with old versions of MinGW
  2462. (`#129 <https://github.com/fmtlib/fmt/issues/129>`_,
  2463. `#130 <https://github.com/fmtlib/fmt/pull/130>`_,
  2464. `#132 <https://github.com/fmtlib/fmt/issues/132>`_).
  2465. Thanks to `@cstamford (Christopher Stamford) <https://github.com/cstamford>`_.
  2466. * Fixed a compile error on MSVC with disabled exceptions
  2467. (`#144 <https://github.com/fmtlib/fmt/issues/144>`_).
  2468. * Added a workaround for broken implementation of variadic templates in MSVC2012
  2469. (`#148 <https://github.com/fmtlib/fmt/issues/148>`_).
  2470. * Placed the anonymous namespace within ``fmt`` namespace for the header-only
  2471. configuration
  2472. (`#171 <https://github.com/fmtlib/fmt/issues/171>`_).
  2473. Thanks to `@alfps (Alf P. Steinbach) <https://github.com/alfps>`_.
  2474. * Fixed issues reported by Coverity Scan
  2475. (`#187 <https://github.com/fmtlib/fmt/issues/187>`_,
  2476. `#192 <https://github.com/fmtlib/fmt/issues/192>`_).
  2477. * Implemented a workaround for a name lookup bug in MSVC2010
  2478. (`#188 <https://github.com/fmtlib/fmt/issues/188>`_).
  2479. * Fixed compiler warnings
  2480. (`#95 <https://github.com/fmtlib/fmt/issues/95>`_,
  2481. `#96 <https://github.com/fmtlib/fmt/issues/96>`_,
  2482. `#114 <https://github.com/fmtlib/fmt/pull/114>`_,
  2483. `#135 <https://github.com/fmtlib/fmt/issues/135>`_,
  2484. `#142 <https://github.com/fmtlib/fmt/issues/142>`_,
  2485. `#145 <https://github.com/fmtlib/fmt/issues/145>`_,
  2486. `#146 <https://github.com/fmtlib/fmt/issues/146>`_,
  2487. `#158 <https://github.com/fmtlib/fmt/issues/158>`_,
  2488. `#163 <https://github.com/fmtlib/fmt/issues/163>`_,
  2489. `#175 <https://github.com/fmtlib/fmt/issues/175>`_,
  2490. `#190 <https://github.com/fmtlib/fmt/issues/190>`_,
  2491. `#191 <https://github.com/fmtlib/fmt/pull/191>`_,
  2492. `#194 <https://github.com/fmtlib/fmt/issues/194>`_,
  2493. `#196 <https://github.com/fmtlib/fmt/pull/196>`_,
  2494. `#216 <https://github.com/fmtlib/fmt/issues/216>`_,
  2495. `#218 <https://github.com/fmtlib/fmt/pull/218>`_,
  2496. `#220 <https://github.com/fmtlib/fmt/pull/220>`_,
  2497. `#229 <https://github.com/fmtlib/fmt/pull/229>`_,
  2498. `#233 <https://github.com/fmtlib/fmt/issues/233>`_,
  2499. `#234 <https://github.com/fmtlib/fmt/issues/234>`_,
  2500. `#236 <https://github.com/fmtlib/fmt/pull/236>`_,
  2501. `#281 <https://github.com/fmtlib/fmt/issues/281>`_,
  2502. `#289 <https://github.com/fmtlib/fmt/issues/289>`_).
  2503. Thanks to `@seanmiddleditch (Sean Middleditch) <https://github.com/seanmiddleditch>`_,
  2504. `@dixlorenz (Dix Lorenz) <https://github.com/dixlorenz>`_,
  2505. `@CarterLi (李通洲) <https://github.com/CarterLi>`_,
  2506. `@Naios <https://github.com/Naios>`_,
  2507. `@fmatthew5876 (Matthew Fioravante) <https://github.com/fmatthew5876>`_,
  2508. `@LevskiWeng (Levski Weng) <https://github.com/LevskiWeng>`_,
  2509. `@rpopescu <https://github.com/rpopescu>`_,
  2510. `@gabime (Gabi Melman) <https://github.com/gabime>`_,
  2511. `@cubicool (Jeremy Moles) <https://github.com/cubicool>`_,
  2512. `@jkflying (Julian Kent) <https://github.com/jkflying>`_,
  2513. `@LogicalKnight (Sean L) <https://github.com/LogicalKnight>`_,
  2514. `@inguin (Ingo van Lil) <https://github.com/inguin>`_ and
  2515. `@Jopie64 (Johan) <https://github.com/Jopie64>`_.
  2516. * Fixed portability issues (mostly causing test failures) on ARM, ppc64, ppc64le,
  2517. s390x and SunOS 5.11 i386
  2518. (`#138 <https://github.com/fmtlib/fmt/issues/138>`_,
  2519. `#179 <https://github.com/fmtlib/fmt/issues/179>`_,
  2520. `#180 <https://github.com/fmtlib/fmt/issues/180>`_,
  2521. `#202 <https://github.com/fmtlib/fmt/issues/202>`_,
  2522. `#225 <https://github.com/fmtlib/fmt/issues/225>`_,
  2523. `Red Hat Bugzilla Bug 1260297 <https://bugzilla.redhat.com/show_bug.cgi?id=1260297>`_).
  2524. Thanks to `@Naios <https://github.com/Naios>`_,
  2525. `@jackyf (Eugene V. Lyubimkin) <https://github.com/jackyf>`_ and Dave Johansen.
  2526. * Fixed a name conflict with macro ``free`` defined in
  2527. ``crtdbg.h`` when ``_CRTDBG_MAP_ALLOC`` is set
  2528. (`#211 <https://github.com/fmtlib/fmt/issues/211>`_).
  2529. * Fixed shared library build on OS X
  2530. (`#212 <https://github.com/fmtlib/fmt/pull/212>`_).
  2531. Thanks to `@dean0x7d (Dean Moldovan) <https://github.com/dean0x7d>`_.
  2532. * Fixed an overload conflict on MSVC when ``/Zc:wchar_t-`` option is specified
  2533. (`#214 <https://github.com/fmtlib/fmt/pull/214>`_).
  2534. Thanks to `@slavanap (Vyacheslav Napadovsky) <https://github.com/slavanap>`_.
  2535. * Improved compatibility with MSVC 2008
  2536. (`#236 <https://github.com/fmtlib/fmt/pull/236>`_).
  2537. Thanks to `@Jopie64 (Johan) <https://github.com/Jopie64>`_.
  2538. * Improved compatibility with bcc32
  2539. (`#227 <https://github.com/fmtlib/fmt/issues/227>`_).
  2540. * Fixed ``static_assert`` detection on Clang
  2541. (`#228 <https://github.com/fmtlib/fmt/pull/228>`_).
  2542. Thanks to `@dean0x7d (Dean Moldovan) <https://github.com/dean0x7d>`_.
  2543. 1.1.0 - 2015-03-06
  2544. ------------------
  2545. * Added ``BasicArrayWriter``, a class template that provides operations for
  2546. formatting and writing data into a fixed-size array
  2547. (`#105 <https://github.com/fmtlib/fmt/issues/105>`_ and
  2548. `#122 <https://github.com/fmtlib/fmt/issues/122>`_):
  2549. .. code:: c++
  2550. char buffer[100];
  2551. fmt::ArrayWriter w(buffer);
  2552. w.write("The answer is {}", 42);
  2553. * Added `0 A.D. <http://play0ad.com/>`_ and `PenUltima Online (POL)
  2554. <http://www.polserver.com/>`_ to the list of notable projects using C++ Format.
  2555. * C++ Format now uses MSVC intrinsics for better formatting performance
  2556. (`#115 <https://github.com/fmtlib/fmt/pull/115>`_,
  2557. `#116 <https://github.com/fmtlib/fmt/pull/116>`_,
  2558. `#118 <https://github.com/fmtlib/fmt/pull/118>`_ and
  2559. `#121 <https://github.com/fmtlib/fmt/pull/121>`_).
  2560. Previously these optimizations where only used on GCC and Clang.
  2561. Thanks to `@CarterLi <https://github.com/CarterLi>`_ and
  2562. `@objectx <https://github.com/objectx>`_.
  2563. * CMake install target (`#119 <https://github.com/fmtlib/fmt/pull/119>`_).
  2564. Thanks to `@TrentHouliston <https://github.com/TrentHouliston>`_.
  2565. You can now install C++ Format with ``make install`` command.
  2566. * Improved `Biicode <http://www.biicode.com/>`_ support
  2567. (`#98 <https://github.com/fmtlib/fmt/pull/98>`_ and
  2568. `#104 <https://github.com/fmtlib/fmt/pull/104>`_). Thanks to
  2569. `@MariadeAnton <https://github.com/MariadeAnton>`_ and
  2570. `@franramirez688 <https://github.com/franramirez688>`_.
  2571. * Improved support for building with `Android NDK
  2572. <https://developer.android.com/tools/sdk/ndk/index.html>`_
  2573. (`#107 <https://github.com/fmtlib/fmt/pull/107>`_).
  2574. Thanks to `@newnon <https://github.com/newnon>`_.
  2575. The `android-ndk-example <https://github.com/fmtlib/android-ndk-example>`_
  2576. repository provides and example of using C++ Format with Android NDK:
  2577. .. image:: https://raw.githubusercontent.com/fmtlib/android-ndk-example/
  2578. master/screenshot.png
  2579. * Improved documentation of ``SystemError`` and ``WindowsError``
  2580. (`#54 <https://github.com/fmtlib/fmt/issues/54>`_).
  2581. * Various code improvements
  2582. (`#110 <https://github.com/fmtlib/fmt/pull/110>`_,
  2583. `#111 <https://github.com/fmtlib/fmt/pull/111>`_
  2584. `#112 <https://github.com/fmtlib/fmt/pull/112>`_).
  2585. Thanks to `@CarterLi <https://github.com/CarterLi>`_.
  2586. * Improved compile-time errors when formatting wide into narrow strings
  2587. (`#117 <https://github.com/fmtlib/fmt/issues/117>`_).
  2588. * Fixed ``BasicWriter::write`` without formatting arguments when C++11 support
  2589. is disabled (`#109 <https://github.com/fmtlib/fmt/issues/109>`_).
  2590. * Fixed header-only build on OS X with GCC 4.9
  2591. (`#124 <https://github.com/fmtlib/fmt/issues/124>`_).
  2592. * Fixed packaging issues (`#94 <https://github.com/fmtlib/fmt/issues/94>`_).
  2593. * Added `changelog <https://github.com/fmtlib/fmt/blob/master/ChangeLog.rst>`_
  2594. (`#103 <https://github.com/fmtlib/fmt/issues/103>`_).
  2595. 1.0.0 - 2015-02-05
  2596. ------------------
  2597. * Add support for a header-only configuration when ``FMT_HEADER_ONLY`` is
  2598. defined before including ``format.h``:
  2599. .. code:: c++
  2600. #define FMT_HEADER_ONLY
  2601. #include "format.h"
  2602. * Compute string length in the constructor of ``BasicStringRef``
  2603. instead of the ``size`` method
  2604. (`#79 <https://github.com/fmtlib/fmt/issues/79>`_).
  2605. This eliminates size computation for string literals on reasonable optimizing
  2606. compilers.
  2607. * Fix formatting of types with overloaded ``operator <<`` for ``std::wostream``
  2608. (`#86 <https://github.com/fmtlib/fmt/issues/86>`_):
  2609. .. code:: c++
  2610. fmt::format(L"The date is {0}", Date(2012, 12, 9));
  2611. * Fix linkage of tests on Arch Linux
  2612. (`#89 <https://github.com/fmtlib/fmt/issues/89>`_).
  2613. * Allow precision specifier for non-float arguments
  2614. (`#90 <https://github.com/fmtlib/fmt/issues/90>`_):
  2615. .. code:: c++
  2616. fmt::print("{:.3}\n", "Carpet"); // prints "Car"
  2617. * Fix build on Android NDK
  2618. (`#93 <https://github.com/fmtlib/fmt/issues/93>`_)
  2619. * Improvements to documentation build procedure.
  2620. * Remove ``FMT_SHARED`` CMake variable in favor of standard `BUILD_SHARED_LIBS
  2621. <http://www.cmake.org/cmake/help/v3.0/variable/BUILD_SHARED_LIBS.html>`_.
  2622. * Fix error handling in ``fmt::fprintf``.
  2623. * Fix a number of warnings.
  2624. 0.12.0 - 2014-10-25
  2625. -------------------
  2626. * [Breaking] Improved separation between formatting and buffer management.
  2627. ``Writer`` is now a base class that cannot be instantiated directly.
  2628. The new ``MemoryWriter`` class implements the default buffer management
  2629. with small allocations done on stack. So ``fmt::Writer`` should be replaced
  2630. with ``fmt::MemoryWriter`` in variable declarations.
  2631. Old code:
  2632. .. code:: c++
  2633. fmt::Writer w;
  2634. New code:
  2635. .. code:: c++
  2636. fmt::MemoryWriter w;
  2637. If you pass ``fmt::Writer`` by reference, you can continue to do so:
  2638. .. code:: c++
  2639. void f(fmt::Writer &w);
  2640. This doesn't affect the formatting API.
  2641. * Support for custom memory allocators
  2642. (`#69 <https://github.com/fmtlib/fmt/issues/69>`_)
  2643. * Formatting functions now accept `signed char` and `unsigned char` strings as
  2644. arguments (`#73 <https://github.com/fmtlib/fmt/issues/73>`_):
  2645. .. code:: c++
  2646. auto s = format("GLSL version: {}", glGetString(GL_VERSION));
  2647. * Reduced code bloat. According to the new `benchmark results
  2648. <https://github.com/fmtlib/fmt#compile-time-and-code-bloat>`_,
  2649. cppformat is close to ``printf`` and by the order of magnitude better than
  2650. Boost Format in terms of compiled code size.
  2651. * Improved appearance of the documentation on mobile by using the `Sphinx
  2652. Bootstrap theme <http://ryan-roemer.github.io/sphinx-bootstrap-theme/>`_:
  2653. .. |old| image:: https://cloud.githubusercontent.com/assets/576385/4792130/
  2654. cd256436-5de3-11e4-9a62-c077d0c2b003.png
  2655. .. |new| image:: https://cloud.githubusercontent.com/assets/576385/4792131/
  2656. cd29896c-5de3-11e4-8f59-cac952942bf0.png
  2657. +-------+-------+
  2658. | Old | New |
  2659. +-------+-------+
  2660. | |old| | |new| |
  2661. +-------+-------+
  2662. 0.11.0 - 2014-08-21
  2663. -------------------
  2664. * Safe printf implementation with a POSIX extension for positional arguments:
  2665. .. code:: c++
  2666. fmt::printf("Elapsed time: %.2f seconds", 1.23);
  2667. fmt::printf("%1$s, %3$d %2$s", weekday, month, day);
  2668. * Arguments of ``char`` type can now be formatted as integers
  2669. (Issue `#55 <https://github.com/fmtlib/fmt/issues/55>`_):
  2670. .. code:: c++
  2671. fmt::format("0x{0:02X}", 'a');
  2672. * Deprecated parts of the API removed.
  2673. * The library is now built and tested on MinGW with Appveyor in addition to
  2674. existing test platforms Linux/GCC, OS X/Clang, Windows/MSVC.
  2675. 0.10.0 - 2014-07-01
  2676. -------------------
  2677. **Improved API**
  2678. * All formatting methods are now implemented as variadic functions instead
  2679. of using ``operator<<`` for feeding arbitrary arguments into a temporary
  2680. formatter object. This works both with C++11 where variadic templates are
  2681. used and with older standards where variadic functions are emulated by
  2682. providing lightweight wrapper functions defined with the ``FMT_VARIADIC``
  2683. macro. You can use this macro for defining your own portable variadic
  2684. functions:
  2685. .. code:: c++
  2686. void report_error(const char *format, const fmt::ArgList &args) {
  2687. fmt::print("Error: {}");
  2688. fmt::print(format, args);
  2689. }
  2690. FMT_VARIADIC(void, report_error, const char *)
  2691. report_error("file not found: {}", path);
  2692. Apart from a more natural syntax, this also improves performance as there
  2693. is no need to construct temporary formatter objects and control arguments'
  2694. lifetimes. Because the wrapper functions are very lightweight, this doesn't
  2695. cause code bloat even in pre-C++11 mode.
  2696. * Simplified common case of formatting an ``std::string``. Now it requires a
  2697. single function call:
  2698. .. code:: c++
  2699. std::string s = format("The answer is {}.", 42);
  2700. Previously it required 2 function calls:
  2701. .. code:: c++
  2702. std::string s = str(Format("The answer is {}.") << 42);
  2703. Instead of unsafe ``c_str`` function, ``fmt::Writer`` should be used directly
  2704. to bypass creation of ``std::string``:
  2705. .. code:: c++
  2706. fmt::Writer w;
  2707. w.write("The answer is {}.", 42);
  2708. w.c_str(); // returns a C string
  2709. This doesn't do dynamic memory allocation for small strings and is less error
  2710. prone as the lifetime of the string is the same as for ``std::string::c_str``
  2711. which is well understood (hopefully).
  2712. * Improved consistency in naming functions that are a part of the public API.
  2713. Now all public functions are lowercase following the standard library
  2714. conventions. Previously it was a combination of lowercase and
  2715. CapitalizedWords.
  2716. Issue `#50 <https://github.com/fmtlib/fmt/issues/50>`_.
  2717. * Old functions are marked as deprecated and will be removed in the next
  2718. release.
  2719. **Other Changes**
  2720. * Experimental support for printf format specifications (work in progress):
  2721. .. code:: c++
  2722. fmt::printf("The answer is %d.", 42);
  2723. std::string s = fmt::sprintf("Look, a %s!", "string");
  2724. * Support for hexadecimal floating point format specifiers ``a`` and ``A``:
  2725. .. code:: c++
  2726. print("{:a}", -42.0); // Prints -0x1.5p+5
  2727. print("{:A}", -42.0); // Prints -0X1.5P+5
  2728. * CMake option ``FMT_SHARED`` that specifies whether to build format as a
  2729. shared library (off by default).
  2730. 0.9.0 - 2014-05-13
  2731. ------------------
  2732. * More efficient implementation of variadic formatting functions.
  2733. * ``Writer::Format`` now has a variadic overload:
  2734. .. code:: c++
  2735. Writer out;
  2736. out.Format("Look, I'm {}!", "variadic");
  2737. * For efficiency and consistency with other overloads, variadic overload of
  2738. the ``Format`` function now returns ``Writer`` instead of ``std::string``.
  2739. Use the ``str`` function to convert it to ``std::string``:
  2740. .. code:: c++
  2741. std::string s = str(Format("Look, I'm {}!", "variadic"));
  2742. * Replaced formatter actions with output sinks: ``NoAction`` -> ``NullSink``,
  2743. ``Write`` -> ``FileSink``, ``ColorWriter`` -> ``ANSITerminalSink``.
  2744. This improves naming consistency and shouldn't affect client code unless
  2745. these classes are used directly which should be rarely needed.
  2746. * Added ``ThrowSystemError`` function that formats a message and throws
  2747. ``SystemError`` containing the formatted message and system-specific error
  2748. description. For example, the following code
  2749. .. code:: c++
  2750. FILE *f = fopen(filename, "r");
  2751. if (!f)
  2752. ThrowSystemError(errno, "Failed to open file '{}'") << filename;
  2753. will throw ``SystemError`` exception with description
  2754. "Failed to open file '<filename>': No such file or directory" if file
  2755. doesn't exist.
  2756. * Support for AppVeyor continuous integration platform.
  2757. * ``Format`` now throws ``SystemError`` in case of I/O errors.
  2758. * Improve test infrastructure. Print functions are now tested by redirecting
  2759. the output to a pipe.
  2760. 0.8.0 - 2014-04-14
  2761. ------------------
  2762. * Initial release