You don't need the `.getRoot<PyRegionProto>()` on the last line. Do:
builder.setRoot(pyRegionImplProto);
-Kenton
On Mon, Apr 24, 2017 at 5:50 PM, <[email protected]> wrote:
> Hi Kenton, I got into a pickle trying to convert a reader into a builder
> in C++. The relevant code looks like this:
>
> ```
> PyObject* Network::_readPyRegion(const std::string& moduleName,
> const std::string& className,
> RegionProto::Reader& proto)
> {
> capnp::AnyPointer::Reader implProto = proto.getRegionImpl();
>
> PyRegionProto::Reader pyRegionImplProto = implProto.getAs<PyRegionProto>
> ();
>
> // See PyRegion::read implementation for reference
>
> capnp::MallocMessageBuilder builder;
> builder.setRoot(pyRegionImplProto.getRoot<PyRegionProto>()); // copy
> ```
>
> The last line chokes during compilation: "*error: **no member named
> 'getRoot' in 'PyRegionProto::Reader*"
>
> Thank you,
> Vitaly
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/capnproto.
>
--
You received this message because you are subscribed to the Google Groups
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.