44#include " ndtbl/detail/mapped_payload.hpp"
55#include " ndtbl/runtime_field_group.hpp"
66
7+ #include < array>
8+ #include < cstddef>
9+ #include < cstdint>
710#include < fstream>
11+ #include < memory>
12+ #include < ostream>
813#include < stdexcept>
914#include < string>
15+ #include < utility>
1016#include < vector>
1117
1218namespace ndtbl {
@@ -177,8 +183,9 @@ read_group(const std::string& path)
177183 PayloadView<float >(payload_owner.get (), layout.value_count ),
178184 payload_owner));
179185#else
180- const std::vector<float > values =
181- detail::read_payload<float >(is, value_count);
186+ // Keep this non-const so the payload buffer can be moved into the
187+ // read-only FieldGroup storage instead of copied during load.
188+ std::vector<float > values = detail::read_payload<float >(is, value_count);
182189 return RuntimeFieldGroup<Dim>(
183190 FieldGroup<float , Dim>(grid, metadata.field_names , std::move (values)));
184191#endif
@@ -195,8 +202,9 @@ read_group(const std::string& path)
195202 PayloadView<double >(payload_owner.get (), layout.value_count ),
196203 payload_owner));
197204#else
198- const std::vector<double > values =
199- detail::read_payload<double >(is, value_count);
205+ // Keep this non-const so the payload buffer can be moved into the
206+ // read-only FieldGroup storage instead of copied during load.
207+ std::vector<double > values = detail::read_payload<double >(is, value_count);
200208 return RuntimeFieldGroup<Dim>(
201209 FieldGroup<double , Dim>(grid, metadata.field_names , std::move (values)));
202210#endif
0 commit comments