Commit 8f6d1235 authored by Rosen Penev's avatar Rosen Penev

remove std::distance usage

std::distance internally runs a loop, which may or may not be optimized
away. Just use simple arithmetic.
Signed-off-by: default avatarRosen Penev <rosenp@gmail.com>
parent d368ed58
......@@ -34,7 +34,7 @@ SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG
{
auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
if (it != std::end(level_string_views))
return static_cast<level::level_enum>(std::distance(std::begin(level_string_views), it));
return static_cast<level::level_enum>(it - std::begin(level_string_views));
// check also for "warn" and "err" before giving up..
if (name == "warn")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment