Когда я попытался использовать его с функцией шаблона с переменным числом вариантов, я столкнулся с проблемой: я не вижу места для размещения параметра source_location.
Следующее не работает, поскольку переменные параметры должны быть в конце:
Код: Выделить всё
// doesn't work
template
void debug(Args&&... args,
const std::source_location& loc = std::source_location::current());
Код: Выделить всё
// doesn't work either, because ...
template
void debug(const std::source_location& loc = std::source_location::current(),
Args&&... args);
// the caller will get confused
debug(42); // error: cannot convert 42 to std::source_location
Подробнее здесь: https://stackoverflow.com/questions/575 ... e-function