mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-07-16 06:37:02 +02:00
Fixed usage of fmt::format and fmt::print for C++20 (#323)
With C++20 `fmt::print(s)` expects a compile time format string and otherwise fails complaining about consteval. To get runtime formatting use `fmt::print(fmt::runtime(s))`
This commit is contained in:
+1
-1
@@ -260,7 +260,7 @@ if(AARE_FETCH_FMT)
|
||||
FetchContent_MakeAvailable(fmt)
|
||||
set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
else()
|
||||
find_package(fmt 6 REQUIRED)
|
||||
find_package(fmt 8 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(AARE_FETCH_JSON)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
- Fixed ``split_task(first, last, n_threads)`` so task ranges now correctly respect the ``first`` offset. Previously, non-zero starting indices could generate incorrect subranges.
|
||||
- Fixed overflow issue causing failed allocations for NDArrays abouve ~2GB
|
||||
- Fixed libfmt failures due to consteval when building with C++20
|
||||
|
||||
|
||||
## 2026.3.17
|
||||
|
||||
@@ -50,8 +50,8 @@ std::filesystem::path RawFileNameComponents::data_fname(size_t mod_id,
|
||||
if (m_old_scheme) {
|
||||
fmt = "{}_d{}_f{:012}_{}.raw";
|
||||
}
|
||||
return m_base_path /
|
||||
fmt::format(fmt, m_base_name, mod_id, file_id, m_file_index);
|
||||
return m_base_path / fmt::format(fmt::runtime(fmt), m_base_name, mod_id,
|
||||
file_id, m_file_index);
|
||||
}
|
||||
|
||||
void RawFileNameComponents::set_old_scheme(bool old_scheme) {
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ void RawSubFile::parse_fname(const std::filesystem::path &fname) {
|
||||
}
|
||||
|
||||
std::filesystem::path RawSubFile::fpath(size_t file_index) const {
|
||||
auto fname = fmt::format(m_base_name, file_index);
|
||||
auto fname = fmt::format(fmt::runtime(m_base_name), file_index);
|
||||
return m_path / fname;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
namespace aare {
|
||||
|
||||
void assert_failed(const std::string &msg) {
|
||||
fmt::print(msg);
|
||||
fmt::print("{}", msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user