DarkRadiant: master 1360d3fe

Author Committer Branch Timestamp Parent
Matthew Mott Matthew Mott master 25.07.2023 19:01 master 45ae7f0f
Changeset Remove all exception-based string::convert implementations

Using exceptions to detect conversion failures is terrible for
performance, and the need for an explicit specialisation for every type
so that a different std::sto[??]() function can be called negates the
benefit of using templates altogether.

There is now a generic implementation using stringstream, along with
specialisations for bool (which behaves differently to the usual
stream extraction) and std::string (which is a no-op).

The separate tryConvertTo{Float,Int}() which were introduced to improve
performance in certain hot code paths, are unaffected by this change.
mod - libs/string/convert.h Diff File