edponce commented on code in PR #12055:
URL: https://github.com/apache/arrow/pull/12055#discussion_r849753208


##########
cpp/src/arrow/chunked_array.h:
##########
@@ -182,6 +183,7 @@ class ARROW_EXPORT ChunkedArray {
   std::shared_ptr<DataType> type_;
 
  private:
+  std::unique_ptr<internal::ChunkResolver> chunk_resolver_;

Review Comment:
   There is no defer initialization, initialization of `ChunkResolver` occurs 
during `ChunkedArray` construction. Dynamically allocated is the only way I am 
able to get this to work due to the fact that `std::atomic` does not have a 
copy/move/assignment constructor and making a regular object in `ChunkResolver` 
clashes with the [explicitly defaulted move constructor/assignment operator of 
`ChunkedArray`](https://github.com/apache/arrow/blob/master/cpp/src/arrow/chunked_array.h#L71).
 If we remove them then we can bypass the dynamic allocation.
   
   Also, moving a dynamic pointer with an atomic member preserves the correct 
reference to the atomic variable, while "moving" an atomic is not possible.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to