zanmato1984 commented on code in PR #40237:
URL: https://github.com/apache/arrow/pull/40237#discussion_r1558699322


##########
cpp/src/arrow/scalar.cc:
##########
@@ -542,6 +542,21 @@ struct ScalarValidateImpl {
   }
 };
 
+template <size_t offset, typename T, typename... Args>
+void FillScalarScratchSpaceHelper(uint8_t* scratch_space, T first, Args... 
args) {
+  static_assert(offset + sizeof(T) <= internal::kScalarScratchSpaceSize);
+  *reinterpret_cast<T*>(scratch_space + offset) = first;
+  if constexpr (sizeof...(args) > 0) {
+    FillScalarScratchSpaceHelper<offset + sizeof(T)>(scratch_space,
+                                                     
std::forward<Args>(args)...);
+  }
+}
+
+template <typename... Args>
+void FillScalarScratchSpace(Args... args) {
+  FillScalarScratchSpaceHelper<0>(std::forward<Args>(args)...);
+}
+

Review Comment:
   Oh, I wanted to make `FillScalarScratchSpace` able to accept arbitrary 
number of arguments of arbitrary types, meanwhile do the copy type-safely.



-- 
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