• addie
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    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.