Std :: source_location - только имя файла, а не полный путь - подстроение времени компиляции?C++

Программы на C++. Форум разработчиков
Anonymous
Std :: source_location - только имя файла, а не полный путь - подстроение времени компиляции?

Сообщение Anonymous »

Есть ли способ создать подстроение во время компиляции, и не nastry String в двоичном? />

Код: Выделить всё

#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]

Вернуться в «C++»