[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] | ^
Как использовать выходные данные fmt::format() в fmt::print()?
int main() { int i = 42; std::string s = fmt::format("line {}", i);
fmt::print(s); } [/code] не компилируется с библиотекой {fmt} v10.1.0 и g++ v13.1, что приводит к следующим ошибкам: [code][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] | ^ [/code] Как использовать выходные данные fmt::format() в fmt::print()?