common: Make TrimSourcePath constexpr (#6279)

This commit is contained in:
Steveice10 2023-02-03 10:01:10 -08:00 committed by GitHub
parent 3a6a17c708
commit 78cb48b23c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -11,7 +11,7 @@
namespace Log { namespace Log {
// trims up to and including the last of ../, ..\, src/, src\ in a string // trims up to and including the last of ../, ..\, src/, src\ in a string
inline const char* TrimSourcePath(std::string_view source) { constexpr const char* TrimSourcePath(std::string_view source) {
const auto rfind = [source](const std::string_view match) { const auto rfind = [source](const std::string_view match) {
return source.rfind(match) == source.npos ? 0 : (source.rfind(match) + match.size()); return source.rfind(match) == source.npos ? 0 : (source.rfind(match) + match.size());
}; };