News for hackers. Stuff that matters.
Re:std::source_location Is Broken by lionkor on Thursday November 16, 2023 @03:27PM (#38295001)
you can also do compile time strlen(), if you are ok with goofy variadic templates
Re:std::source_location Is Broken by UebVar on Thursday November 16, 2023 @05:14PM (#38296356)
Implementing a constexpr strlen() is trivial and I looks just like it's from your ancient C textbook, save for the "constexpr" keyword. No goofyness involved.

Or you use what the C++ standard library has to offer.

std::string_view(ptr).length(); or std::string(ptr).length(); or std::char_traits<char>::length(ptr); all work at compile time.