You’re right, that doesn’t make any sense.

Turned out to be related to the fact that it was being called in a
constructor, and some unrelated things weren’t initialized yet. I had just
gotten confused by the backtrace output.

Sorry for the noise.

On Tue, Jan 9, 2018 at 9:41 AM Kenton Varda <[email protected]> wrote:

> 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, <[email protected]> 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 [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.

Reply via email to