As Henrique mentioned, the generated C++ code generates a declaration for op<, but it doesn't provide an implementation. Some of Thrift's tests provide an implementation in a separate C++ file. Thrift does not currently code generate a definition for op<. Generating an op< in the same C++ files that we currently generate would be a breaking change (multiply defined symbols).
So Brian, you can provide an implementation for the code generated op<, and you can do so without modifying the generated code. We already provide implementations of op== and op!=. > From: Henrique Mendonça <[email protected]> > To: [email protected], > Date: 11/07/2013 07:57 AM > Subject: Re: C++ operator< > Sent by: [email protected] > > If I'm not wrong the < is defined but not implemented, so you can implement > it in any other cpp file and linker will do the job. It's like the part > file on C# but also kind of a hack. Hopefully someone has a better idea. > > I think we would be able to generate the operator too, just calling the > same operator of every member in other of declaration? What you think? > Just let us know if you have a patch. > > Cheers, > Henrique > > > On 7 November 2013 08:50, Jens Geyer <[email protected]> wrote: > > > Generated code should not be modified for the very reason you mentioned. > > Some languages like C# generate partial classes that can be easilyextended. > > > > It could be worth a look if specifically this operator overload > > could/should be generated as well. One of the C++ people may chime in here. > > ________________________________ > > Von: Bryan Pham > > Gesendet: 07.11.2013 05:26 > > An: [email protected] > > Betreff: C++ operator< > > > > I was wondering what's the best practice for editing generated code. I > > want to enable operator< but everytime we generate code, I'd have to > > remember to edit the same code over. > >
