Daily bit(e) of C++ | std::lerp
Daily bit(e) of C++ #244, Linear interpolation function: std::lerp.
The std::lerp is a C++20 mathematical function that handles linear interpolation (and extrapolation) for floating-point types.
The function takes three arguments: the two boundary values and an interpolation factor. The implementation will correctly handle infinities and boundary values for the interpolation factor.
another suggestion - the usage of resetiosflags