Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comparison operators for CassUuid #473

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lgeorget
Copy link

Hello Cassandra developers

I've needed operator<() and operator==() implementations for CassUuid variables for a project in which I use CassUuid in std::set or as keys in std::map objects.
Of course, they're pretty trivial to implement but maybe it would be nice to have them in cassandra.h (even if they are for C++ only)?

@mpenick
Copy link
Contributor

mpenick commented May 6, 2020

Thanks for the operators. I'd prefer these live in a C++ specific header and could you add some tests?

@lgeorget
Copy link
Author

Hello (a few months later...)!

So, I've put the operators in a separate header and added tests. However, I've maintained the inclusion of the operators in the main include file (cassandra.h) in order to avoid having to include another header for the operators only. I'm not sure this if this is ok or not. Should we just leave C++-only code in the other header?

@@ -144,6 +144,11 @@ typedef struct CassUuid_ {
cass_uint64_t clock_seq_and_node;
} CassUuid;

#ifdef __cplusplus
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this block. This is broken without adding it to build and packaging.

These operators (for C++) make CassUuid instances usable as keys
in std::set, std::map, etc. containers.
@lgeorget
Copy link
Author

Hmm, yes... I've renamed the include file, added it to CMakeLists.txt and to the Debian packaging files list. I've tested the packaging under Debian but I'm not able to testHomebrew right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants