Hi Kevin,

Moving a unique_ptr doesn't touch the pointed-to type at all, so the
problem here couldn't possibly have anything to do with
MallocMessageBuilder. I don't see anything obviously wrong with the code
you provided, so the bug must be elsewhere in your code. It is possible
that my_class is an invalid reference? What do you mean when you say that
std::move() "fails"? I honestly can't think of any way that std::move()
could fail at runtime, since it only casts one reference type to another.

-Kenton

On Mon, Jan 8, 2018 at 10:57 PM, <kgree...@gmail.com> wrote:

> I'm trying to figure out how to move a MallocMessageBuilder. I thought
> that if I created a std::unique_ptr to it, then I could move that pointer,
> but it is failing at runtime because the rvalue constructor is deleted.
>
> Am I doing something wrong with my move?
>
> Pseudo-code:
> void my_func(std::unique_ptr<::capnp::MallocMessageBuilder> builder) {
>   my_class.builder = std::move(builder);
> }
> auto builder = std::unique_ptr<::capnp::MallocMessageBuilder>();
> // ... initialize the builder ...
> my_func(std::move(builder));
>
> Is there a way to move a MallocMessageBuilder without just using a raw
> pointer? It fails at runtime in the std::move call in my function.
>
> Thanks!
>
> --
> 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 capnproto+unsubscr...@googlegroups.com.
> 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 capnproto+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to