this post was submitted on 13 Sep 2023
8 points (100.0% liked)
C++
1783 readers
5 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Maybe a bit of a poor example - writing an integer to a string isn't the main problem area that
std::format
helps with, getting consistent output of doubles and lining them up is much more useful, and being able to line up unicode double / half width characters in columns is nice too. Maybe the wrong thing to measure - most apps aren't rate limited by formatting operations, and the ones that are probably need a bit more control than the standard library can provide - but it's nice that it's quicker.More of a concern for me is having to specialise a template function in the headers that define 'classes, structs and enums that I'd like to output formatted', in a very similar manner to how its done for hash specialisation. Ugly, ugly code; at least writing an
std::ostream &operator<<
definition is a one-liner.