diff --git a/include/spdlog/common-inl.h b/include/spdlog/common-inl.h index 9fd2bcb5..728f9831 100644 --- a/include/spdlog/common-inl.h +++ b/include/spdlog/common-inl.h @@ -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(it - std::begin(level_string_views)); + return static_cast(std::distance(std::begin(level_string_views), it)); // check also for "warn" and "err" before giving up.. if (name == "warn")