-
Notifications
You must be signed in to change notification settings - Fork 138
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
Refactor[BMQT]: make QueueOptions rule-of-three complaint #371
Refactor[BMQT]: make QueueOptions rule-of-three complaint #371
Conversation
71ee553
to
6c94a4d
Compare
} | ||
else { | ||
d_subscriptions = Subscriptions(rhs.d_subscriptions, | ||
rhs.d_allocator_p); |
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.
From the bsl::unordered_map
docs:
propagate to this object the allocator of rhs if the ALLOCATOR type has trait propagate_on_container_copy_assignment
The usual assignment operator might propagate the allocator and might not. Here, I make sure to construct the unordered map with the allocator from rhs
.
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.
bsl::allocator
, which the map uses, doesn't allow this propagation: https://bloomberg.github.io/bde-resources/doxygen/bde_api_prod/group__bslma__stdallocator.html
I also don't think we should be rhs
's allocator in this case, if allocator propagation were to happen on copy construction the class would handle it itself. Regardless I don't think we want to grab rhs
's allocator this way. From the properties of [UsesBslmaAllocator
trait docs](https://bloomberg.github.io/bde-resources/doxygen/bde_api_prod/group__bslma__usesbslmaallocator.html):
- The allocator used by an object is not changed after construction (e.g., the assignment operator does not change the allocator used by an object).
So what I think we really want here is to use this
's allocator to do each of these allocation operations.
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
f67ee24
to
bd8689a
Compare
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.
lgtm
Remove 400 lines from build logs