Код: Выделить всё
#include
int main() {
int i = 42;
std::string s = fmt::format("line {}", i);
fmt::print(s);
}
Код: Выделить всё
[build] /home/paul/st-cpp/test-cpp/kodz/so-3.cpp:7:13: error: the value of ‘s’ is not usable in a constant expression
[build] 7 | fmt::print(s);
[build] | ~~~~~~~~~~^~~
[build] /home/paul/st-cpp/test-cpp/kodz/so-3.cpp:5:15: note: ‘s’ was not declared ‘constexpr’
[build] 5 | std::string s = fmt::format("line {}", i);
[build] | ^
Подробнее здесь: https://stackoverflow.com/questions/792 ... h-fmtprint