-
Notifications
You must be signed in to change notification settings - Fork 67
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 support for movability to random generators. Fix POSIX random provider #74
Conversation
fc70b82
to
479cd12
Compare
Interesting that you chose to do this without boost::move, any particular reason? |
Ideally we should have a compile-fail test that attempts copy by constructor and another copy by assignment to make sure those are properly disabled. This would ensure in the future nobody re-enables it by accident. |
I did not want to pull in Boost.Move as a dependency. But if you think it's worth supporting move operations in C++03 then it can be added. |
I was trying to do it with Boost.Move but it wasn't cooperating with me. It was probably me though. :) I'd prefer it to be implementation that works with both language levels. The dependencies in move are pretty light: https://pdimov.github.io/boostdep-report/develop/move.html I also offered to help the maintainer of Boost.Move add CI to that repository when I found it had none. |
…vider. The commit adds support for move constructors and assignment to random UUID generators and random providers. Also, in POSIX random provider, the commit improves handling of return value from ::read(), which returns -1 in case of error and may return 0 in case of success. Retry the call when it was interrupted before reading any bytes from /dev/urandom. Added new tests for movability and compile-fail tests for no copyability. This addresses GitHub issue: boostorg#71
479cd12
to
429daf0
Compare
Codecov Report
@@ Coverage Diff @@
## develop #74 +/- ##
===========================================
+ Coverage 78.34% 79.78% +1.43%
===========================================
Files 13 13
Lines 605 638 +33
Branches 156 154 -2
===========================================
+ Hits 474 509 +35
Misses 17 17
+ Partials 114 112 -2
Continue to review full report at Codecov.
|
I've added support for C++03 and compile-fail tests. |
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.
Works fine for me with VS 2017 Update 7.3 and Update 8 Preview 2.0.
Would be nice to add a unit test for the EINTR handling at some point. Thanks for the help on move. |
The commit adds support for move constructors and assignment to random UUID
generators and random providers. Also, in POSIX random provider, the commit
improves handling of return value from ::read(), which returns -1
in case of error and may return 0 in case of success. Retry the call when
it was interrupted before reading any bytes from /dev/urandom.
Added new tests for movability.
This fixes #71