@@ -84,6 +84,41 @@ RecordComponent::storeChunk(Offset o, Extent e, F &&createBuffer)
8484 .storeSpan <T>(std::forward<F>(createBuffer));
8585}
8686
87+ namespace detail
88+ {
89+ template <typename T>
90+ struct pointer_as_void ;
91+
92+ template <typename T>
93+ struct pointer_as_void <std::shared_ptr<T>>
94+ {
95+ static auto call (std::shared_ptr<T> const &ptr)
96+ -> std::shared_ptr<void const >
97+ {
98+ return std::static_pointer_cast<void const >(ptr);
99+ }
100+ };
101+
102+ template <typename T>
103+ struct pointer_as_void <std::unique_ptr<T>>
104+ {
105+ static auto call (std::unique_ptr<T> &&ptr) -> UniquePtrWithLambda<void>
106+ {
107+ return UniquePtrWithLambda<void >(std::move (ptr));
108+ }
109+ };
110+ template <typename T>
111+ struct pointer_as_void <std::unique_ptr<T[]>>
112+ {
113+ static auto call (std::unique_ptr<T[]> &&ptr)
114+ -> UniquePtrWithLambda<void>
115+ {
116+ return UniquePtrWithLambda<T[]>(std::move (ptr))
117+ .template static_cast_ <void >();
118+ }
119+ };
120+ } // namespace detail
121+
87122template <typename T, typename F>
88123inline DynamicMemoryView<T> RecordComponent::storeChunkSpanCreateBuffer_impl (
89124 internal::LoadStoreConfig cfg, F &&createBuffer)
@@ -157,10 +192,12 @@ inline DynamicMemoryView<T> RecordComponent::storeChunkSpanCreateBuffer_impl(
157192 getBufferView.out ->ptr = static_cast <void *>(data.get ());
158193 if (size > 0 )
159194 {
195+ using ptr_type = decltype (data);
160196 internal::LoadStoreConfigWithBuffer ls_cfg{
161197 std::move (o), std::move (e), std::nullopt };
162198 storeChunk_impl (
163- auxiliary::WriteBuffer (std::move (data)),
199+ auxiliary::WriteBuffer (
200+ detail::pointer_as_void<ptr_type>::call (std::move (data))),
164201 getBufferView.dtype ,
165202 std::move (ls_cfg),
166203 /* flush_immediately=*/ false );
0 commit comments