rtpsw commented on code in PR #13375:
URL: https://github.com/apache/arrow/pull/13375#discussion_r898289154


##########
cpp/src/arrow/compute/registry.cc:
##########
@@ -115,20 +210,42 @@ std::unique_ptr<FunctionRegistry> 
FunctionRegistry::Make() {
   return std::unique_ptr<FunctionRegistry>(new FunctionRegistry());
 }
 
-FunctionRegistry::FunctionRegistry() { impl_.reset(new 
FunctionRegistryImpl()); }
+std::unique_ptr<FunctionRegistry> FunctionRegistry::Make(FunctionRegistry* 
parent) {
+  return std::unique_ptr<FunctionRegistry>(new FunctionRegistry(

Review Comment:
   This fails to compile because `explicit 
FunctionRegistry(FunctionRegistryImpl* impl)` is private (see compiler output 
below). Looks like the existing code works because it is all within the scope 
of `FunctionRegistry` whereas using `make_unique` introduces another scope.
   ```
   In file included from 
/mnt/user1/tscontract/github/rtpsw/arrow/cpp/src/arrow/compute/registry.cc:19:
   /mnt/user1/tscontract/github/rtpsw/arrow/cpp/src/arrow/util/make_unique.h: 
In instantiation of ‘typename std::enable_if<(! std::is_array< 
<template-parameter-1-1> >::value), std::unique_ptr<T> >::type 
arrow::internal::make_unique(A&& ...) [with T = 
arrow::compute::FunctionRegistry; A = 
{arrow::compute::FunctionRegistry::FunctionRegistryImpl*}; typename 
std::enable_if<(! std::is_array< <template-parameter-1-1> >::value), 
std::unique_ptr<T> >::type = 
std::unique_ptr<arrow::compute::FunctionRegistry>]’:
   
/mnt/user1/tscontract/github/rtpsw/arrow/cpp/src/arrow/compute/registry.cc:216:70:
   required from here
   
/mnt/user1/tscontract/github/rtpsw/arrow/cpp/src/arrow/util/make_unique.h:30:29:
 error: 
‘arrow::compute::FunctionRegistry::FunctionRegistry(arrow::compute::FunctionRegistry::FunctionRegistryImpl*)’
 is private within this context
      30 |   return std::unique_ptr<T>(new T(std::forward<A>(args)...));
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
/mnt/user1/tscontract/github/rtpsw/arrow/cpp/src/arrow/compute/registry.cc:221:1:
 note: declared private here
     221 | FunctionRegistry::FunctionRegistry(FunctionRegistryImpl* impl) { 
impl_.reset(impl); }
         | ^~~~~~~~~~~~~~~~
   ```



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