C++20 std::format (05.10.2020)
Verfasst: Dienstag 6. Februar 2024, 22:04
Ich weiß, dass ich ca. 4 Jahre zu spät dran bin. Da ich selbst kein C++ kann, haben mich die Standards nie interessiert.
Mir ist aber heute beim Durchlesen von ein paar Artikeln aufgefallen, dass C++ std::format sich an der Python-Syntax orientiert.
Der Heise-Artikel dazu: https://www.heise.de/blog/std-format-in ... 19132.html
C++:
Python:
Die Funktion und Methode Format sind mit Python 3000 eingeführt worden: a-new-approach-to-string-formatting (PEP 3101/)
Die Veröffentlichung war am 14.02.2009, also 11 Jahre eher als bei C++.
Mir ist aber heute beim Durchlesen von ein paar Artikeln aufgefallen, dass C++ std::format sich an der Python-Syntax orientiert.
Der Heise-Artikel dazu: https://www.heise.de/blog/std-format-in ... 19132.html
C++:
Code: Alles auswählen
print("I'd rather be {1} than {0}.\n", "right", "happy");
Code: Alles auswählen
print("I'd rather be {1} than {0}.\n".format("right", "happy"))
Die Veröffentlichung war am 14.02.2009, also 11 Jahre eher als bei C++.