[
https://issues.apache.org/jira/browse/THRIFT-539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nitay Joffe updated THRIFT-539:
-------------------------------
Attachment: thrift-539.patch
Patch rebased to latest trunk.
This patch has three parts:
# Add operator<< to Thrift structs. This uses some recursive template magic
that I added in
# Add an option to generate a boost style hash_value() function to thrift
structs. This is only generated if you specify the option "boost_hash" to the
thrift compiler. I made this an option because it adds a dependency on the
header boost/functional.hash.hpp
# Generate TBB style HashCompare struct. The hash function in this currently
just calls the hash_value() above, so this also is only generated if the option
"boost_hash" is given. This doesn't actually require any TBB headers to be
included, so in theory it's safe to always put it in. If you want, I can make
it do it's own hashing (not depend on boost hash_value()) and then always
include it.
Let me know what you think. I am fine with ripping out certain pieces of this
patch. Please don't dismiss the whole patch because you don't like one part of
it.
> struct hash and print methods for C++
> -------------------------------------
>
> Key: THRIFT-539
> URL: https://issues.apache.org/jira/browse/THRIFT-539
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (C++), Library (C++)
> Reporter: Nitay Joffe
> Priority: Minor
> Attachments: thrift-539.patch
>
>
> The current thrift compiler for C++ generates methods for structs like
> operator== and operator< since it uses maps,sets, etc but it does not
> generate a hash() method or a human readable print() method.
> The idea of this issue is to add functionality to the C++ compiler to
> generate:
> # A boost hash compatible hash_value() function. This should probably be an
> option to the compiler as it adds a dependency in generated code on boost.
> # An operator<< function for printing structs in a nice form. This should be
> safe to always do?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.