Add an operator< for Thrift structs (in C++).
authorDavid Reiss <dreiss@apache.org>
Wed, 27 Feb 2008 19:38:51 +0000 (19:38 +0000)
committerDavid Reiss <dreiss@apache.org>
Wed, 27 Feb 2008 19:38:51 +0000 (19:38 +0000)
commitcf2e8d9af3650212ed02d61e3f21c4eb29c6ffa4
tree02b83d98f94b303593ea224b91a59bc60d57a358
parentf0cf2a37456034d699b396b7f9cdd28ba467500e
Add an operator< for Thrift structs (in C++).

Some people want to use sets of Thrift structs.  This has interesting
implications, but it is a reasonable request.  However, in C++,
this requires structures to have a less-than operator.
It seems a little dangerous to auto-generate an arbitrary comparator,
but allowing users to define their own operator< implementations
seems fine.  This change makes that a lot easier.

The one downside of this change is that developers who try to compare
structures with operator< (including trying to make sets of them)
will now get a linker error instead of a compiler error.
However, the old compiler error was so scary that
I'm not sure this is any worse.

Reviewed By: kholst, mcslee

Test Plan: make check

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665527 13f79535-47bb-0310-9956-ffa450edef68
compiler/cpp/src/generate/t_cpp_generator.cc