Fix: add default constructor to TaskRecord for map operator[]

boost::container::map::operator[] default-constructs the mapped_type
when the key doesn't exist. TaskRecord lacked a default constructor
after the e21b2af refactor (only had an allocator-arg constructor).
Added a static vec_allocator_f (matching RuleStatShm.h pattern) and a
default constructor that initializes data_record with it.
This commit is contained in:
Huamonarch 2026-05-13 09:27:29 +08:00
parent 0a5397345c
commit df79a9a1a5

View File

@ -27,8 +27,15 @@ typedef bipc::managed_mapped_file::segment_manager segment_manager_t;
typedef bipc::node_allocator<float, segment_manager_t> vec_allocator_f;
typedef boost::container::vector<float, vec_allocator_f> shm_vector_f;
static vec_allocator_f
default_allocator(obj_mapped_file.get_segment_manager());
struct TaskRecord {
shm_vector_f data_record;
TaskRecord()
: data_record(default_allocator) {}
TaskRecord(const bipc::node_allocator<void, segment_manager_t> &alloc)
: data_record(alloc) {}
};