From df79a9a1a57133a26f2eaa2f416af547f4a423f6 Mon Sep 17 00:00:00 2001 From: Huamonarch Date: Wed, 13 May 2026 09:27:29 +0800 Subject: [PATCH] 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. --- shm/TaskData.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shm/TaskData.h b/shm/TaskData.h index 4b03382..bc85233 100644 --- a/shm/TaskData.h +++ b/shm/TaskData.h @@ -27,8 +27,15 @@ typedef bipc::managed_mapped_file::segment_manager segment_manager_t; typedef bipc::node_allocator vec_allocator_f; typedef boost::container::vector 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 &alloc) : data_record(alloc) {} };