Newbie Question Shared Memory Containers/Allocators
Hi everybody,
how are you?
I am a completely noob when it comes to Boost. :D But not a noob when it comes to C++. Though, am a bit noobish when it comes to C++14 and beyond :D
I am trying to construct a complex data container, which has a vector of floats, on managed shared memory.
I followed the documentation, added the appropriate headers and made the following declarations:
typedef managed_windows_shared_memory::segment_manager segment_manager_t;
typedef allocator
On 02/02/2020 7:07, Da Xu via Boost-users wrote:
Hi everybody,
how are you?
I am a completely noob when it comes to Boost. :D But not a noob when it comes to C++. Though, am a bit noobish when it comes to C++14 and beyond :D
I am trying to construct a complex data container, which has a vector of floats, on managed shared memory.
I followed the documentation, added the appropriate headers and made the following declarations:
typedef managed_windows_shared_memory::segment_manager segment_manager_t; typedef allocator
void_allocator; typedef basic_string shared_string; typedef allocator float_allocator; typedef vector float_vector; typedef allocator float_vector_allocator; class ComplexContainer { shared_string name; float_vector channelData;
public: ComplexContainer(const char * name_, const float* data_start, const float* data_end, const void_allocator& void_alloc) : name(name_), channelData(data_start, data_end, void_alloc) {}
ComplexContainer(const void_allocator& void_alloc) : name(void_alloc), channelData(void_alloc) {}
ComplexContainer() {}
}
Hi, 1) shared_string also needs char_allocator as a second parameter. 2) a float vector does not expect a void_allocator, but a float_vector_allocator Best, Ion
participants (2)
-
Da Xu
-
Ion Gaztañaga