pitrou commented on a change in pull request #12448:
URL: https://github.com/apache/arrow/pull/12448#discussion_r808997942
##########
File path: cpp/src/arrow/engine/substrait/expression_internal.cc
##########
@@ -443,8 +443,11 @@ struct ScalarToProtoImpl {
return Status::OK();
}
+ // Note: while std::string&& would be better for the argument
+ // type, older versions of protobuf don't have this overload
+ // yet.
template <typename ScalarWithBufferValue>
- Status FromBuffer(void (substrait::Expression::Literal::*set)(std::string&&),
+ Status FromBuffer(void (substrait::Expression::Literal::*set)(const
std::string&),
Review comment:
You could also take a lambda and let C++ resolve the best overload there:
```c++
template <typename LitteralSetter>
Status FromBuffer(LitteralSetter&& set_lit,
const ScalarWithBufferValue& scalar_with_buffer) {
set_lit(lit_, scalar_with_buffer.value->ToString());
return Status::OK();
}
Status Visit(const StringScalar& s) {
return FromBuffer([](Lit* lit, std::string s) {
lit->set_string(std::move(s)); });
}
```
--
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]