|
|
Log in / Subscribe / Register

Pedantry

Pedantry

Posted Jun 14, 2022 1:28 UTC (Tue) by tialaramex (subscriber, #21167)
In reply to: Vetting the cargo by int19h
Parent article: Vetting the cargo

std::format() was added by C++ 20, so, if you're using C++ 98, C++ 03, C++ 11, C++ 14 or C++ 17 this isn't available.

Also, while many modern languages will just cut to the chase, UTF-8 or GTFO, in C++ 20 strings are just containers for arbitrary sequences of values in some implementation defined encoding, so the standard can't say exactly how wide anything is, and although real world implementations probably do what you expect you're assured of nothing for this "width" specification, that's entirely implementation defined. Good luck.


to post comments

Pedantry

Posted Jun 14, 2022 2:44 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]

> Also, while many modern languages will just cut to the chase, UTF-8 or GTFO, in C++ 20 strings are just containers for arbitrary sequences of values

I remember that there was a bug filed against the C++ spec because strings were not working when parametrized by doubles due to alignment issues on 32-bit CPUs.

Pedantry

Posted Jun 14, 2022 17:12 UTC (Tue) by madscientist (subscriber, #16861) [Link]

std::format is in C++20 but folks using older C++ compilers can use fmtlib: https://github.com/fmtlib/fmt


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds