Hi,

I have something like this in my Thrift schema:

struct TestStatusOne { .... }
struct TestStatusTwo { .... }

union TestStatus {
  1: TestStatusOne  ONE
  2: TestStatusTwo  TWO
}

struct TestResult {
  1: required TestStatus status
}

I can define this fine using Java, Perl and Python libraries, but am
having trouble doing it with the C++ libraries. Here is an example in
Java:

TestResult testResult = new TestResult(
  new TestStatus(TestStatus._Fields.findByName("ONE"), testStatus)
);

The closest I have got to getting it defined in C++ is:

TestResult testResult;
testResult.status.ONE = testStatus;

But when I try to send to the server I get an error telling me the
status field is not present, and the dump of the structure shows it as
null.

How can I set the test status?

Using Thrift 0.6.1.

Thanks,
Andrew

Reply via email to