Export of internal Abseil changes.
-- ed3a3431eee9e48e6553b0320e0308d2dde6725c by Derek Mauro <dmauro@google.com>: Project import generated by Copybara. PiperOrigin-RevId: 258631680 GitOrigin-RevId: ed3a3431eee9e48e6553b0320e0308d2dde6725c Change-Id: I1d7ae86a79783842092d29504605ba039c369603
This commit is contained in:
parent
44efe96dfc
commit
c6c3c1b498
32 changed files with 1168 additions and 657 deletions
|
|
@ -77,10 +77,18 @@ class node_handle_base {
|
|||
protected:
|
||||
friend struct CommonAccess;
|
||||
|
||||
node_handle_base(const allocator_type& a, slot_type* s) : alloc_(a) {
|
||||
struct transfer_tag_t {};
|
||||
node_handle_base(transfer_tag_t, const allocator_type& a, slot_type* s)
|
||||
: alloc_(a) {
|
||||
PolicyTraits::transfer(alloc(), slot(), s);
|
||||
}
|
||||
|
||||
struct move_tag_t {};
|
||||
node_handle_base(move_tag_t, const allocator_type& a, slot_type* s)
|
||||
: alloc_(a) {
|
||||
PolicyTraits::construct(alloc(), slot(), s);
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
if (!empty()) {
|
||||
PolicyTraits::destroy(alloc(), slot());
|
||||
|
|
@ -121,7 +129,7 @@ class node_handle : public node_handle_base<PolicyTraits, Alloc> {
|
|||
private:
|
||||
friend struct CommonAccess;
|
||||
|
||||
node_handle(const Alloc& a, typename Base::slot_type* s) : Base(a, s) {}
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
// For maps.
|
||||
|
|
@ -148,7 +156,7 @@ class node_handle<Policy, PolicyTraits, Alloc,
|
|||
private:
|
||||
friend struct CommonAccess;
|
||||
|
||||
node_handle(const Alloc& a, typename Base::slot_type* s) : Base(a, s) {}
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
// Provide access to non-public node-handle functions.
|
||||
|
|
@ -164,8 +172,13 @@ struct CommonAccess {
|
|||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static T Make(Args&&... args) {
|
||||
return T(std::forward<Args>(args)...);
|
||||
static T Transfer(Args&&... args) {
|
||||
return T(typename T::transfer_tag_t{}, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static T Move(Args&&... args) {
|
||||
return T(typename T::move_tag_t{}, std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue