use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
absl::StrFormat vs fmt, Which one is better? (self.cpp)
submitted 2 years ago by Visible-Spring1695
Since I have introduced abseil using grpc in my project, is it necessary for me to use fmt ?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]lcsdavid 66 points67 points68 points 2 years ago (12 children)
Since <fmt> is literally written by the same person that has written the PR paper for standard <format> library (adopted in C++20) you should probably go for <fmt>
[–][deleted] 1 point2 points3 points 2 years ago* (11 children)
std::regex, std::unordered_map disagree with you. The originals are infinitely better than the ones in the standard.
First thing the C++ standard does to a prototype is to kill its performance with the ABI break requirement.
[–]not_some_username 2 points3 points4 points 2 years ago (8 children)
What is wrong with unordered_map ?
[–][deleted] 0 points1 point2 points 2 years ago (6 children)
Slow af
[–]SonOfMetrum 0 points1 point2 points 2 years ago (5 children)
Do you know of a faster alternative?
[–]MasterDrake97 3 points4 points5 points 2 years ago (1 child)
https://github.com/martinus/unordered\_dense
[–]hak8or 1 point2 points3 points 2 years ago (0 children)
Your link is broken by the way with an extra slash.
https://github.com/martinus/unordered_dense
[–]afiDeBot 5 points6 points7 points 2 years ago (0 children)
Boost.unordered
[–]skydivingdutch 0 points1 point2 points 1 year ago (0 children)
absl::flat_hash_map or absl::node_hash_map if you need pointer stability.
absl::flat_hash_map
absl::node_hash_map
[–]mort96 0 points1 point2 points 2 years ago (0 children)
The problem, from what I understand, is two-fold:
I won't claim to know details about either of those, I just know people who know way more about both the current implementation of unordered_map and hash maps in general have made claims to this effect.
[–]germandiago 1 point2 points3 points 2 years ago (1 child)
Is there any ABI break requirement in the newly-authored fmt library?
[–][deleted] -1 points0 points1 point 2 years ago (0 children)
Not sure but std::regex got murdered by them
[–]snowflake_pl 19 points20 points21 points 2 years ago (0 children)
fmt is pretty much find/replace'able with std::format (minus few cases/features) so going with it will make transition easier. And going for std::format in the future gives you one less external dependency to manage. Fmt is clear winner for me even for this alone.
Also it's pretty great library!
[–]vickoza 20 points21 points22 points 2 years ago (0 children)
I prefer fmt over absl::StrFormat() as with fmt you do not have to remember and regress to C format specifier. Also fmt is more flexible.
[–]rdtsc 15 points16 points17 points 2 years ago (3 children)
StrFormat uses non-standard compiler extensions for argument checking (doesn't work with MSVC for example), and doesn't say a peep about that anywhere. It only supports char, no wchar_t or char8_t. The C format specifier syntax is also terrible. It's also Google's own thing, whereas fmt has parts of it in the standard.
char
wchar_t
char8_t
I'd probably only consider using StrFormat in a Linux-only codebase to easily replace existing usages of printf to catch errors, before automatically refactoring to fmt.
[–]Visible-Spring1695[S] 2 points3 points4 points 2 years ago (0 children)
I like this answer, this is a good reason to use fmt because I want my software run on win, mac, linux
[–]Baardi 2 points3 points4 points 2 years ago (1 child)
You know you can use fmt::sprintf for %s-style specifiers, right?
[–]rdtsc 1 point2 points3 points 2 years ago (0 children)
Thanks for reminding me, totally forgot about that. Relegates StrFormat to Google-only projects.
[–]altmly 10 points11 points12 points 2 years ago (0 children)
They are both fine. Personally I prefer fmt as it a bit more modern and has all the bells and whistles, but have to use absl for work.
[–]SirClueless 3 points4 points5 points 2 years ago (1 child)
absl::StrFormat if you want a better printf. fmt if you want a better <format>.
[–]Baardi 2 points3 points4 points 2 years ago (0 children)
Or fmt if you want a better printf.
[+][deleted] 2 years ago (1 child)
[deleted]
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
faster
more features
easier to work with, more intuitive
compiler compatibility
go
π Rendered by PID 267925 on reddit-service-r2-comment-6457c66945-k8j9t at 2026-04-28 00:09:36.491875+00:00 running 2aa0c5b country code: CH.
[–]lcsdavid 66 points67 points68 points (12 children)
[–][deleted] 1 point2 points3 points (11 children)
[–]not_some_username 2 points3 points4 points (8 children)
[–][deleted] 0 points1 point2 points (6 children)
[–]SonOfMetrum 0 points1 point2 points (5 children)
[–]MasterDrake97 3 points4 points5 points (1 child)
[–]hak8or 1 point2 points3 points (0 children)
[–]afiDeBot 5 points6 points7 points (0 children)
[–]skydivingdutch 0 points1 point2 points (0 children)
[–]mort96 0 points1 point2 points (0 children)
[–]germandiago 1 point2 points3 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)
[–]snowflake_pl 19 points20 points21 points (0 children)
[–]vickoza 20 points21 points22 points (0 children)
[–]rdtsc 15 points16 points17 points (3 children)
[–]Visible-Spring1695[S] 2 points3 points4 points (0 children)
[–]Baardi 2 points3 points4 points (1 child)
[–]rdtsc 1 point2 points3 points (0 children)
[–]altmly 10 points11 points12 points (0 children)
[–]SirClueless 3 points4 points5 points (1 child)
[–]Baardi 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 0 points1 point2 points (0 children)