Here is some example code you could play with:

#include "test.pb.h"

int main(int args, const char **arg)
{
    Message1 m1;
    m1.set_a("22");
    m1.set_b("33");
    WrapperMessage wm1;
    wm1.set_allocated_m1(&m1);
    auto s = wm1.SerializeAsString();

    WrapperMessage wm2;
    wm2.ParseFromString(s);
    if (wm2.has_m1())
    {
        auto msg1 = wm2.m1();
        auto msg1a = msg1.a();
        auto msg1b = msg1.b();
    }

    return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/57e7fc88-b416-42e8-bd17-b42eaa8e73cf%40googlegroups.com.

Reply via email to