Suppose I have a message:
message Foo{
  oneof b_message {
    Bar = 16;
    Baz = 17;
  }
}

and I have some C++ handler that is a templated function:
template<class T>
void b_handler(const T&);
template void b_handler(const Bar& bar){...}
template void b_handler(const Baz& baz){...}  

What I'd like to be able to do is:
void foo_handler(const Foo& foo){
  ...
  b_handler(foo.b_message());
}  

Essentially, if protoc generated some kind of function like
template<class T>
const T& Foo::b_message() const;
const Bar& Foo::b_message() const;
const Baz& Foo::b_message() const;

that would make for automatic handling of whatever kind of b_message Foo 
had carried, rather than doing a switch(foo.b_message_case()) type decision 
tree.

I'm sure there are a lot of edge cases that I'm not thinking of, or 
cross-language considerations, but is anything like this possible?

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to