abumq / easyloggingpp

C++ logging library. It is extremely powerful, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc.
MIT License
3.75k stars 918 forks source link

-Wrange-loop-construct in for (const std::pair<std::string,...) #828

Open linhaigoo opened 1 year ago

linhaigoo commented 1 year ago

I'm using the latest code 8489989 and enable all gcc warnings and it reports -Wrange-loop-construct warnings in sentence " for (const std::pair<std::string,...: map container) " such as " for (const std::pair<std::string, base::type::LoggerRegistrationCallbackPtr>& h".

It found that the "const std::pair<std::string,...>& h" may not avoid construct objects because "std::string" in std::pair should be "const std::string". It's better to directly use "const auto &" for elimenating confusing of type matching.