Код: Выделить всё
#include
#include
consteval std::string_view filename_only(
std::experimental::source_location location = std::experimental::source_location::current())
{
std::string_view s = location.file_name();
return s.substr(s.find_last_of('/')+1);
}
int main()
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/73854659/stdsource-location-filename-only-not-full-path-compile-time-substring[/url]
Мобильная версия