33 #ifndef ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_ 34 #define ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_ 39 #include <type_traits> 43 namespace container_internal {
45 template <
class Reference,
class Policy>
49 using slot_type =
typename std::remove_cv<
50 typename std::remove_reference<Reference>::type>::type*;
52 template <
class Alloc,
class... Args>
54 *slot = Policy::new_element(alloc, std::forward<Args>(args)...);
57 template <
class Alloc>
59 Policy::delete_element(alloc, *slot);
62 template <
class Alloc>
64 *new_slot = *old_slot;
68 if (slot ==
nullptr)
return Policy::element_space_used(
nullptr);
69 return Policy::element_space_used(*slot);
74 template <
class T,
class P = Policy>
79 template <
class... Ts,
class P = Policy>
80 static auto apply(Ts&&... ts) -> decltype(
P::apply(std::forward<Ts>(ts)...)) {
81 return P::apply(std::forward<Ts>(ts)...);
88 #endif // ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_ static size_t space_used(const slot_type *slot)
static void transfer(Alloc *, slot_type *new_slot, slot_type *old_slot)
static void destroy(Alloc *alloc, slot_type *slot)
static auto value(T *elem) -> decltype(P::value(elem))
typename std::remove_cv< typename std::remove_reference< Reference >::type >::type * slot_type
static Reference element(slot_type *slot)
static auto apply(Ts &&...ts) -> decltype(P::apply(std::forward< Ts >(ts)...))
static void construct(Alloc *alloc, slot_type *slot, Args &&...args)
std::allocator< int > alloc
MockFunction< int(int)> apply