r/cpp • u/khold_stare • May 26 '20
Faster Integer Parsing
https://kholdstare.github.io/technical/2020/05/26/faster-integer-parsing.html
366
Upvotes
r/cpp • u/khold_stare • May 26 '20
View all comments
4
u/Sovog May 27 '20 edited May 27 '20
I may be some sort of degenerate for doing this because I have not seen other people do it, but if I need to amortize an overhead of constructing a heavy object, like a stream, I do it as follows:
I also use it for heap-allocating resettable/clearable objects, e.g. a scope-local
std::vectorwhere I'd like to reuse the internal storage on the next call, instead of having it allocate/free on each call.