-
Notifications
You must be signed in to change notification settings - Fork 265
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
Have C++ defaults behave like stl defaults #193
Conversation
See CI, we have...
|
*/ | ||
bool ra_init(roaring_array_t *t); | ||
void ra_init(roaring_array_t *t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be marked noexcept as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure what you are asking.. That is a C function and cannot be marked as noexcept
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I got lost. You're right. GCC does have a nothrow attribute you can add to C functions but it's not necessary here.
It appears that the move constructors on MSVC are not marked as So the question is, do we want to conditionally do this static assert if we are on gcc or clang, or just remove it all together: https://github.com/RoaringBitmap/CRoaring/pull/193/files/9d0f97ae04ce4bfbed307ed358bbc225f7f088ab#diff-597bc881be4cdb305734afd4ac73dc2dR24 |
@Brian-Esch Why do we need the static assert? That is, what is the harm in removing it? |
@lemire Unless there are objections I would like to leave the static assert for the |
- Change `bool ra_init()` to `void ra_init()`, initializes array to have zero capacity. Does not `malloc` and cannot fail. ABI breaking change - Have `Roaring` ctor use new `ra_init()` - Make `Roaring` move ctor and move assignment `noexcept`. This is important for performance when holding them in stl containers (avoids copying) - Delete dtor, copy ctor, move ctor, copy assignment operator and move assignment operator for `RoaringSetBitForwardIterator` and `Roaring64Map` since these objects don't manage any lifetimes manually. The compiler provides these by _default_ to us - Add `static_assert` that `Roaring` is are `noexcept` moveable in cpp unit test file
9d0f97a
to
de66621
Compare
This now looks good to me. Congrats! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent.
Change
bool ra_init()
tovoid ra_init()
, initializes array to havezero capacity. Does not
malloc
and cannot fail. ABI breaking changeHave
Roaring
ctor use newra_init()
Make
Roaring
move ctor and move assignmentnoexcept
. This is importantfor performance when holding them in stl containers (avoids copying)
Delete dtor, copy ctor, move ctor, copy assignment operator and move
assignment operator for
RoaringSetBitForwardIterator
andRoaring64Map
since these objects don't manage any lifetimes manually. The compiler
provides these by default to us
Add
static_assert
s that C++ classes arenoexcept
moveable in cppunit test file