@@ -82,6 +82,41 @@ RecordComponent::storeChunk(Offset o, Extent e, F &&createBuffer)
8282 .enqueueStore <T>(std::forward<F>(createBuffer));
8383}
8484
85+ namespace detail
86+ {
87+ template <typename T>
88+ struct pointer_as_void ;
89+
90+ template <typename T>
91+ struct pointer_as_void <std::shared_ptr<T>>
92+ {
93+ static auto call (std::shared_ptr<T> const &ptr)
94+ -> std::shared_ptr<void const >
95+ {
96+ return std::static_pointer_cast<void const >(ptr);
97+ }
98+ };
99+
100+ template <typename T>
101+ struct pointer_as_void <std::unique_ptr<T>>
102+ {
103+ static auto call (std::unique_ptr<T> &&ptr) -> UniquePtrWithLambda<void>
104+ {
105+ return UniquePtrWithLambda<void >(std::move (ptr));
106+ }
107+ };
108+ template <typename T>
109+ struct pointer_as_void <std::unique_ptr<T[]>>
110+ {
111+ static auto call (std::unique_ptr<T[]> &&ptr)
112+ -> UniquePtrWithLambda<void>
113+ {
114+ return UniquePtrWithLambda<T[]>(std::move (ptr))
115+ .template static_cast_ <void >();
116+ }
117+ };
118+ } // namespace detail
119+
85120template <typename T, typename F>
86121inline DynamicMemoryView<T> RecordComponent::storeChunkSpanCreateBuffer_impl (
87122 internal::LoadStoreConfig cfg, F &&createBuffer)
@@ -155,10 +190,12 @@ inline DynamicMemoryView<T> RecordComponent::storeChunkSpanCreateBuffer_impl(
155190 getBufferView.out ->ptr = static_cast <void *>(data.get ());
156191 if (size > 0 )
157192 {
193+ using ptr_type = decltype (data);
158194 internal::LoadStoreConfigWithBuffer ls_cfg{
159195 std::move (o), std::move (e), std::nullopt };
160196 storeChunk_impl (
161- auxiliary::WriteBuffer (std::move (data)),
197+ auxiliary::WriteBuffer (
198+ detail::pointer_as_void<ptr_type>::call (std::move (data))),
162199 getBufferView.dtype ,
163200 std::move (ls_cfg),
164201 /* flush_immediately=*/ false );
0 commit comments