Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2020-02-14 04:20:55


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, segment_manager_t>  void_allocator;
> typedef basic_string<char, std::char_traits<char>, char_allocator>
> shared_string;
> typedef allocator<float, segment_manager_t> float_allocator;
> typedef vector<float, float_allocator> float_vector;
> typedef allocator<float_vector, segment_manager_t> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net