Hacker News new | ask | show | jobs
by plq 1084 days ago
> What's wrong with std::regex?

In my experience, stdlibc++ <regex> is VERY slow, especially on debug builds. We are using g_regex instead, which in turn uses pcre2.

> And iostreams

<iostream> achieves too little with too much code. We instead use:

    std::cout << fmt::format(...);
for simple output, loguru[1] for everything else. I feel like the fmt grammar/mini-language is both nicely extensible and has hit the expressiveness sweet spot -- not too verbose (iostreams) nor too terse (printf).

I also like that fmt has helpers for pointers (fmt::ptr), enums (fmt::underlying) and arrays (fmt::join). It's both easy on the eyes and feels consistent.

[1]: https://github.com/emilk/loguru

2 comments

Consider ``` #include <fmt/os.h>

... fmt::print(...); ``` Instead, to save that potential double buffer copy.

Thanks! Still learning my way around the fmt library.
fmt looks really nice. Probably worth pulling the dependency in for future projects.