third_party/abseil-cpp/absl/memory/memory.h
Go to the documentation of this file.
1 // Copyright 2017 The Abseil Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // -----------------------------------------------------------------------------
16 // File: memory.h
17 // -----------------------------------------------------------------------------
18 //
19 // This header file contains utility functions for managing the creation and
20 // conversion of smart pointers. This file is an extension to the C++
21 // standard <memory> library header file.
22 
23 #ifndef ABSL_MEMORY_MEMORY_H_
24 #define ABSL_MEMORY_MEMORY_H_
25 
26 #include <cstddef>
27 #include <limits>
28 #include <memory>
29 #include <new>
30 #include <type_traits>
31 #include <utility>
32 
33 #include "absl/base/macros.h"
34 #include "absl/meta/type_traits.h"
35 
36 namespace absl {
38 
39 // -----------------------------------------------------------------------------
40 // Function Template: WrapUnique()
41 // -----------------------------------------------------------------------------
42 //
43 // Adopts ownership from a raw pointer and transfers it to the returned
44 // `std::unique_ptr`, whose type is deduced. Because of this deduction, *do not*
45 // specify the template type `T` when calling `WrapUnique`.
46 //
47 // Example:
48 // X* NewX(int, int);
49 // auto x = WrapUnique(NewX(1, 2)); // 'x' is std::unique_ptr<X>.
50 //
51 // Do not call WrapUnique with an explicit type, as in
52 // `WrapUnique<X>(NewX(1, 2))`. The purpose of WrapUnique is to automatically
53 // deduce the pointer type. If you wish to make the type explicit, just use
54 // `std::unique_ptr` directly.
55 //
56 // auto x = std::unique_ptr<X>(NewX(1, 2));
57 // - or -
58 // std::unique_ptr<X> x(NewX(1, 2));
59 //
60 // While `absl::WrapUnique` is useful for capturing the output of a raw
61 // pointer factory, prefer 'absl::make_unique<T>(args...)' over
62 // 'absl::WrapUnique(new T(args...))'.
63 //
64 // auto x = WrapUnique(new X(1, 2)); // works, but nonideal.
65 // auto x = make_unique<X>(1, 2); // safer, standard, avoids raw 'new'.
66 //
67 // Note that `absl::WrapUnique(p)` is valid only if `delete p` is a valid
68 // expression. In particular, `absl::WrapUnique()` cannot wrap pointers to
69 // arrays, functions or void, and it must not be used to capture pointers
70 // obtained from array-new expressions (even though that would compile!).
71 template <typename T>
72 std::unique_ptr<T> WrapUnique(T* ptr) {
73  static_assert(!std::is_array<T>::value, "array types are unsupported");
74  static_assert(std::is_object<T>::value, "non-object types are unsupported");
75  return std::unique_ptr<T>(ptr);
76 }
77 
78 namespace memory_internal {
79 
80 // Traits to select proper overload and return type for `absl::make_unique<>`.
81 template <typename T>
83  using scalar = std::unique_ptr<T>;
84 };
85 template <typename T>
86 struct MakeUniqueResult<T[]> {
87  using array = std::unique_ptr<T[]>;
88 };
89 template <typename T, size_t N>
90 struct MakeUniqueResult<T[N]> {
91  using invalid = void;
92 };
93 
94 } // namespace memory_internal
95 
96 // gcc 4.8 has __cplusplus at 201301 but the libstdc++ shipped with it doesn't
97 // define make_unique. Other supported compilers either just define __cplusplus
98 // as 201103 but have make_unique (msvc), or have make_unique whenever
99 // __cplusplus > 201103 (clang).
100 #if (__cplusplus > 201103L || defined(_MSC_VER)) && \
101  !(defined(__GLIBCXX__) && !defined(__cpp_lib_make_unique))
102 using std::make_unique;
103 #else
104 // -----------------------------------------------------------------------------
105 // Function Template: make_unique<T>()
106 // -----------------------------------------------------------------------------
107 //
108 // Creates a `std::unique_ptr<>`, while avoiding issues creating temporaries
109 // during the construction process. `absl::make_unique<>` also avoids redundant
110 // type declarations, by avoiding the need to explicitly use the `new` operator.
111 //
112 // This implementation of `absl::make_unique<>` is designed for C++11 code and
113 // will be replaced in C++14 by the equivalent `std::make_unique<>` abstraction.
114 // `absl::make_unique<>` is designed to be 100% compatible with
115 // `std::make_unique<>` so that the eventual migration will involve a simple
116 // rename operation.
117 //
118 // For more background on why `std::unique_ptr<T>(new T(a,b))` is problematic,
119 // see Herb Sutter's explanation on
120 // (Exception-Safe Function Calls)[https://herbsutter.com/gotw/_102/].
121 // (In general, reviewers should treat `new T(a,b)` with scrutiny.)
122 //
123 // Example usage:
124 //
125 // auto p = make_unique<X>(args...); // 'p' is a std::unique_ptr<X>
126 // auto pa = make_unique<X[]>(5); // 'pa' is a std::unique_ptr<X[]>
127 //
128 // Three overloads of `absl::make_unique` are required:
129 //
130 // - For non-array T:
131 //
132 // Allocates a T with `new T(std::forward<Args> args...)`,
133 // forwarding all `args` to T's constructor.
134 // Returns a `std::unique_ptr<T>` owning that object.
135 //
136 // - For an array of unknown bounds T[]:
137 //
138 // `absl::make_unique<>` will allocate an array T of type U[] with
139 // `new U[n]()` and return a `std::unique_ptr<U[]>` owning that array.
140 //
141 // Note that 'U[n]()' is different from 'U[n]', and elements will be
142 // value-initialized. Note as well that `std::unique_ptr` will perform its
143 // own destruction of the array elements upon leaving scope, even though
144 // the array [] does not have a default destructor.
145 //
146 // NOTE: an array of unknown bounds T[] may still be (and often will be)
147 // initialized to have a size, and will still use this overload. E.g:
148 //
149 // auto my_array = absl::make_unique<int[]>(10);
150 //
151 // - For an array of known bounds T[N]:
152 //
153 // `absl::make_unique<>` is deleted (like with `std::make_unique<>`) as
154 // this overload is not useful.
155 //
156 // NOTE: an array of known bounds T[N] is not considered a useful
157 // construction, and may cause undefined behavior in templates. E.g:
158 //
159 // auto my_array = absl::make_unique<int[10]>();
160 //
161 // In those cases, of course, you can still use the overload above and
162 // simply initialize it to its desired size:
163 //
164 // auto my_array = absl::make_unique<int[]>(10);
165 
166 // `absl::make_unique` overload for non-array types.
167 template <typename T, typename... Args>
169  Args&&... args) {
170  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
171 }
172 
173 // `absl::make_unique` overload for an array T[] of unknown bounds.
174 // The array allocation needs to use the `new T[size]` form and cannot take
175 // element constructor arguments. The `std::unique_ptr` will manage destructing
176 // these array elements.
177 template <typename T>
179  return std::unique_ptr<T>(new typename absl::remove_extent_t<T>[n]());
180 }
181 
182 // `absl::make_unique` overload for an array T[N] of known bounds.
183 // This construction will be rejected.
184 template <typename T, typename... Args>
186  Args&&... /* args */) = delete;
187 #endif
188 
189 // -----------------------------------------------------------------------------
190 // Function Template: RawPtr()
191 // -----------------------------------------------------------------------------
192 //
193 // Extracts the raw pointer from a pointer-like value `ptr`. `absl::RawPtr` is
194 // useful within templates that need to handle a complement of raw pointers,
195 // `std::nullptr_t`, and smart pointers.
196 template <typename T>
197 auto RawPtr(T&& ptr) -> decltype(std::addressof(*ptr)) {
198  // ptr is a forwarding reference to support Ts with non-const operators.
199  return (ptr != nullptr) ? std::addressof(*ptr) : nullptr;
200 }
201 inline std::nullptr_t RawPtr(std::nullptr_t) { return nullptr; }
202 
203 // -----------------------------------------------------------------------------
204 // Function Template: ShareUniquePtr()
205 // -----------------------------------------------------------------------------
206 //
207 // Adopts a `std::unique_ptr` rvalue and returns a `std::shared_ptr` of deduced
208 // type. Ownership (if any) of the held value is transferred to the returned
209 // shared pointer.
210 //
211 // Example:
212 //
213 // auto up = absl::make_unique<int>(10);
214 // auto sp = absl::ShareUniquePtr(std::move(up)); // shared_ptr<int>
215 // CHECK_EQ(*sp, 10);
216 // CHECK(up == nullptr);
217 //
218 // Note that this conversion is correct even when T is an array type, and more
219 // generally it works for *any* deleter of the `unique_ptr` (single-object
220 // deleter, array deleter, or any custom deleter), since the deleter is adopted
221 // by the shared pointer as well. The deleter is copied (unless it is a
222 // reference).
223 //
224 // Implements the resolution of [LWG 2415](http://wg21.link/lwg2415), by which a
225 // null shared pointer does not attempt to call the deleter.
226 template <typename T, typename D>
227 std::shared_ptr<T> ShareUniquePtr(std::unique_ptr<T, D>&& ptr) {
228  return ptr ? std::shared_ptr<T>(std::move(ptr)) : std::shared_ptr<T>();
229 }
230 
231 // -----------------------------------------------------------------------------
232 // Function Template: WeakenPtr()
233 // -----------------------------------------------------------------------------
234 //
235 // Creates a weak pointer associated with a given shared pointer. The returned
236 // value is a `std::weak_ptr` of deduced type.
237 //
238 // Example:
239 //
240 // auto sp = std::make_shared<int>(10);
241 // auto wp = absl::WeakenPtr(sp);
242 // CHECK_EQ(sp.get(), wp.lock().get());
243 // sp.reset();
244 // CHECK(wp.lock() == nullptr);
245 //
246 template <typename T>
247 std::weak_ptr<T> WeakenPtr(const std::shared_ptr<T>& ptr) {
248  return std::weak_ptr<T>(ptr);
249 }
250 
251 namespace memory_internal {
252 
253 // ExtractOr<E, O, D>::type evaluates to E<O> if possible. Otherwise, D.
254 template <template <typename> class Extract, typename Obj, typename Default,
255  typename>
256 struct ExtractOr {
257  using type = Default;
258 };
259 
260 template <template <typename> class Extract, typename Obj, typename Default>
261 struct ExtractOr<Extract, Obj, Default, void_t<Extract<Obj>>> {
262  using type = Extract<Obj>;
263 };
264 
265 template <template <typename> class Extract, typename Obj, typename Default>
267 
268 // Extractors for the features of allocators.
269 template <typename T>
270 using GetPointer = typename T::pointer;
271 
272 template <typename T>
274 
275 template <typename T>
276 using GetVoidPointer = typename T::void_pointer;
277 
278 template <typename T>
279 using GetConstVoidPointer = typename T::const_void_pointer;
280 
281 template <typename T>
282 using GetDifferenceType = typename T::difference_type;
283 
284 template <typename T>
285 using GetSizeType = typename T::size_type;
286 
287 template <typename T>
289  typename T::propagate_on_container_copy_assignment;
290 
291 template <typename T>
293  typename T::propagate_on_container_move_assignment;
294 
295 template <typename T>
296 using GetPropagateOnContainerSwap = typename T::propagate_on_container_swap;
297 
298 template <typename T>
299 using GetIsAlwaysEqual = typename T::is_always_equal;
300 
301 template <typename T>
302 struct GetFirstArg;
303 
304 template <template <typename...> class Class, typename T, typename... Args>
305 struct GetFirstArg<Class<T, Args...>> {
306  using type = T;
307 };
308 
309 template <typename Ptr, typename = void>
310 struct ElementType {
311  using type = typename GetFirstArg<Ptr>::type;
312 };
313 
314 template <typename T>
315 struct ElementType<T, void_t<typename T::element_type>> {
316  using type = typename T::element_type;
317 };
318 
319 template <typename T, typename U>
321 
322 template <template <typename...> class Class, typename T, typename... Args,
323  typename U>
324 struct RebindFirstArg<Class<T, Args...>, U> {
325  using type = Class<U, Args...>;
326 };
327 
328 template <typename T, typename U, typename = void>
329 struct RebindPtr {
331 };
332 
333 template <typename T, typename U>
334 struct RebindPtr<T, U, void_t<typename T::template rebind<U>>> {
335  using type = typename T::template rebind<U>;
336 };
337 
338 template <typename T, typename U>
339 constexpr bool HasRebindAlloc(...) {
340  return false;
341 }
342 
343 template <typename T, typename U>
344 constexpr bool HasRebindAlloc(typename T::template rebind<U>::other*) {
345  return true;
346 }
347 
348 template <typename T, typename U, bool = HasRebindAlloc<T, U>(nullptr)>
349 struct RebindAlloc {
351 };
352 
353 template <typename T, typename U>
354 struct RebindAlloc<T, U, true> {
355  using type = typename T::template rebind<U>::other;
356 };
357 
358 } // namespace memory_internal
359 
360 // -----------------------------------------------------------------------------
361 // Class Template: pointer_traits
362 // -----------------------------------------------------------------------------
363 //
364 // An implementation of C++11's std::pointer_traits.
365 //
366 // Provided for portability on toolchains that have a working C++11 compiler,
367 // but the standard library is lacking in C++11 support. For example, some
368 // version of the Android NDK.
369 //
370 
371 template <typename Ptr>
373  using pointer = Ptr;
374 
375  // element_type:
376  // Ptr::element_type if present. Otherwise T if Ptr is a template
377  // instantiation Template<T, Args...>
379 
380  // difference_type:
381  // Ptr::difference_type if present, otherwise std::ptrdiff_t
382  using difference_type =
384  std::ptrdiff_t>;
385 
386  // rebind:
387  // Ptr::rebind<U> if exists, otherwise Template<U, Args...> if Ptr is a
388  // template instantiation Template<T, Args...>
389  template <typename U>
391 
392  // pointer_to:
393  // Calls Ptr::pointer_to(r)
394  static pointer pointer_to(element_type& r) { // NOLINT(runtime/references)
395  return Ptr::pointer_to(r);
396  }
397 };
398 
399 // Specialization for T*.
400 template <typename T>
401 struct pointer_traits<T*> {
402  using pointer = T*;
403  using element_type = T;
404  using difference_type = std::ptrdiff_t;
405 
406  template <typename U>
407  using rebind = U*;
408 
409  // pointer_to:
410  // Calls std::addressof(r)
412  element_type& r) noexcept { // NOLINT(runtime/references)
413  return std::addressof(r);
414  }
415 };
416 
417 // -----------------------------------------------------------------------------
418 // Class Template: allocator_traits
419 // -----------------------------------------------------------------------------
420 //
421 // A C++11 compatible implementation of C++17's std::allocator_traits.
422 //
423 #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
424 using std::allocator_traits;
425 #else // __cplusplus >= 201703L
426 template <typename Alloc>
429 
430  // value_type:
431  // Alloc::value_type
432  using value_type = typename Alloc::value_type;
433 
434  // pointer:
435  // Alloc::pointer if present, otherwise value_type*
438 
439  // const_pointer:
440  // Alloc::const_pointer if present, otherwise
441  // absl::pointer_traits<pointer>::rebind<const value_type>
442  using const_pointer =
445  template rebind<const value_type>>;
446 
447  // void_pointer:
448  // Alloc::void_pointer if present, otherwise
449  // absl::pointer_traits<pointer>::rebind<void>
453 
454  // const_void_pointer:
455  // Alloc::const_void_pointer if present, otherwise
456  // absl::pointer_traits<pointer>::rebind<const void>
459  typename absl::pointer_traits<pointer>::template rebind<const void>>;
460 
461  // difference_type:
462  // Alloc::difference_type if present, otherwise
463  // absl::pointer_traits<pointer>::difference_type
467 
468  // size_type:
469  // Alloc::size_type if present, otherwise
470  // std::make_unsigned<difference_type>::type
474 
475  // propagate_on_container_copy_assignment:
476  // Alloc::propagate_on_container_copy_assignment if present, otherwise
477  // std::false_type
481 
482  // propagate_on_container_move_assignment:
483  // Alloc::propagate_on_container_move_assignment if present, otherwise
484  // std::false_type
488 
489  // propagate_on_container_swap:
490  // Alloc::propagate_on_container_swap if present, otherwise std::false_type
494 
495  // is_always_equal:
496  // Alloc::is_always_equal if present, otherwise std::is_empty<Alloc>::type
497  using is_always_equal =
500 
501  // rebind_alloc:
502  // Alloc::rebind<T>::other if present, otherwise Alloc<T, Args> if this Alloc
503  // is Alloc<U, Args>
504  template <typename T>
506 
507  // rebind_traits:
508  // absl::allocator_traits<rebind_alloc<T>>
509  template <typename T>
511 
512  // allocate(Alloc& a, size_type n):
513  // Calls a.allocate(n)
514  static pointer allocate(Alloc& a, // NOLINT(runtime/references)
515  size_type n) {
516  return a.allocate(n);
517  }
518 
519  // allocate(Alloc& a, size_type n, const_void_pointer hint):
520  // Calls a.allocate(n, hint) if possible.
521  // If not possible, calls a.allocate(n)
522  static pointer allocate(Alloc& a, size_type n, // NOLINT(runtime/references)
523  const_void_pointer hint) {
524  return allocate_impl(0, a, n, hint);
525  }
526 
527  // deallocate(Alloc& a, pointer p, size_type n):
528  // Calls a.deallocate(p, n)
529  static void deallocate(Alloc& a, pointer p, // NOLINT(runtime/references)
530  size_type n) {
531  a.deallocate(p, n);
532  }
533 
534  // construct(Alloc& a, T* p, Args&&... args):
535  // Calls a.construct(p, std::forward<Args>(args)...) if possible.
536  // If not possible, calls
537  // ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)
538  template <typename T, typename... Args>
539  static void construct(Alloc& a, T* p, // NOLINT(runtime/references)
540  Args&&... args) {
541  construct_impl(0, a, p, std::forward<Args>(args)...);
542  }
543 
544  // destroy(Alloc& a, T* p):
545  // Calls a.destroy(p) if possible. If not possible, calls p->~T().
546  template <typename T>
547  static void destroy(Alloc& a, T* p) { // NOLINT(runtime/references)
548  destroy_impl(0, a, p);
549  }
550 
551  // max_size(const Alloc& a):
552  // Returns a.max_size() if possible. If not possible, returns
553  // std::numeric_limits<size_type>::max() / sizeof(value_type)
554  static size_type max_size(const Alloc& a) { return max_size_impl(0, a); }
555 
556  // select_on_container_copy_construction(const Alloc& a):
557  // Returns a.select_on_container_copy_construction() if possible.
558  // If not possible, returns a.
561  }
562 
563  private:
564  template <typename A>
565  static auto allocate_impl(int, A& a, // NOLINT(runtime/references)
567  -> decltype(a.allocate(n, hint)) {
568  return a.allocate(n, hint);
569  }
570  static pointer allocate_impl(char, Alloc& a, // NOLINT(runtime/references)
572  return a.allocate(n);
573  }
574 
575  template <typename A, typename... Args>
576  static auto construct_impl(int, A& a, // NOLINT(runtime/references)
577  Args&&... args)
578  -> decltype(a.construct(std::forward<Args>(args)...)) {
579  a.construct(std::forward<Args>(args)...);
580  }
581 
582  template <typename T, typename... Args>
583  static void construct_impl(char, Alloc&, T* p, Args&&... args) {
584  ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
585  }
586 
587  template <typename A, typename T>
588  static auto destroy_impl(int, A& a, // NOLINT(runtime/references)
589  T* p) -> decltype(a.destroy(p)) {
590  a.destroy(p);
591  }
592  template <typename T>
593  static void destroy_impl(char, Alloc&, T* p) {
594  p->~T();
595  }
596 
597  template <typename A>
598  static auto max_size_impl(int, const A& a) -> decltype(a.max_size()) {
599  return a.max_size();
600  }
601  static size_type max_size_impl(char, const Alloc&) {
602  return (std::numeric_limits<size_type>::max)() / sizeof(value_type);
603  }
604 
605  template <typename A>
607  -> decltype(a.select_on_container_copy_construction()) {
608  return a.select_on_container_copy_construction();
609  }
611  const Alloc& a) {
612  return a;
613  }
614 };
615 #endif // __cplusplus >= 201703L
616 
617 namespace memory_internal {
618 
619 // This template alias transforms Alloc::is_nothrow into a metafunction with
620 // Alloc as a parameter so it can be used with ExtractOrT<>.
621 template <typename Alloc>
622 using GetIsNothrow = typename Alloc::is_nothrow;
623 
624 } // namespace memory_internal
625 
626 // ABSL_ALLOCATOR_NOTHROW is a build time configuration macro for user to
627 // specify whether the default allocation function can throw or never throws.
628 // If the allocation function never throws, user should define it to a non-zero
629 // value (e.g. via `-DABSL_ALLOCATOR_NOTHROW`).
630 // If the allocation function can throw, user should leave it undefined or
631 // define it to zero.
632 //
633 // allocator_is_nothrow<Alloc> is a traits class that derives from
634 // Alloc::is_nothrow if present, otherwise std::false_type. It's specialized
635 // for Alloc = std::allocator<T> for any type T according to the state of
636 // ABSL_ALLOCATOR_NOTHROW.
637 //
638 // default_allocator_is_nothrow is a class that derives from std::true_type
639 // when the default allocator (global operator new) never throws, and
640 // std::false_type when it can throw. It is a convenience shorthand for writing
641 // allocator_is_nothrow<std::allocator<T>> (T can be any type).
642 // NOTE: allocator_is_nothrow<std::allocator<T>> is guaranteed to derive from
643 // the same type for all T, because users should specialize neither
644 // allocator_is_nothrow nor std::allocator.
645 template <typename Alloc>
647  : memory_internal::ExtractOrT<memory_internal::GetIsNothrow, Alloc,
648  std::false_type> {};
649 
650 #if defined(ABSL_ALLOCATOR_NOTHROW) && ABSL_ALLOCATOR_NOTHROW
651 template <typename T>
652 struct allocator_is_nothrow<std::allocator<T>> : std::true_type {};
653 struct default_allocator_is_nothrow : std::true_type {};
654 #else
656 #endif
657 
658 namespace memory_internal {
659 template <typename Allocator, typename Iterator, typename... Args>
660 void ConstructRange(Allocator& alloc, Iterator first, Iterator last,
661  const Args&... args) {
662  for (Iterator cur = first; cur != last; ++cur) {
665  args...);
666  }
668  while (cur != first) {
669  --cur;
671  }
673  }
674  }
675 }
676 
677 template <typename Allocator, typename Iterator, typename InputIterator>
678 void CopyRange(Allocator& alloc, Iterator destination, InputIterator first,
679  InputIterator last) {
680  for (Iterator cur = destination; first != last;
681  static_cast<void>(++cur), static_cast<void>(++first)) {
684  *first);
685  }
687  while (cur != destination) {
688  --cur;
690  }
692  }
693  }
694 }
695 } // namespace memory_internal
697 } // namespace absl
698 
699 #endif // ABSL_MEMORY_MEMORY_H_
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
absl::pointer_traits
Definition: third_party/abseil-cpp/absl/memory/memory.h:372
absl::WeakenPtr
std::weak_ptr< T > WeakenPtr(const std::shared_ptr< T > &ptr)
Definition: third_party/abseil-cpp/absl/memory/memory.h:247
absl::allocator_traits::construct_impl
static auto construct_impl(int, A &a, Args &&... args) -> decltype(a.construct(std::forward< Args >(args)...))
Definition: third_party/abseil-cpp/absl/memory/memory.h:576
absl::memory_internal::GetFirstArg< Class< T, Args... > >::type
T type
Definition: third_party/abseil-cpp/absl/memory/memory.h:306
absl::memory_internal::ElementType::type
typename GetFirstArg< Ptr >::type type
Definition: third_party/abseil-cpp/absl/memory/memory.h:311
absl::allocator_traits::value_type
typename Alloc::value_type value_type
Definition: third_party/abseil-cpp/absl/memory/memory.h:432
absl::memory_internal::GetPropagateOnContainerSwap
typename T::propagate_on_container_swap GetPropagateOnContainerSwap
Definition: third_party/abseil-cpp/absl/memory/memory.h:296
absl::pointer_traits< T * >::element_type
T element_type
Definition: third_party/abseil-cpp/absl/memory/memory.h:403
absl::allocator_traits::propagate_on_container_swap
memory_internal::ExtractOrT< memory_internal::GetPropagateOnContainerSwap, Alloc, std::false_type > propagate_on_container_swap
Definition: third_party/abseil-cpp/absl/memory/memory.h:493
scalar
Definition: spake25519.c:317
absl::allocator_traits::propagate_on_container_move_assignment
memory_internal::ExtractOrT< memory_internal::GetPropagateOnContainerMoveAssignment, Alloc, std::false_type > propagate_on_container_move_assignment
Definition: third_party/abseil-cpp/absl/memory/memory.h:487
google::protobuf.internal::true_type
integral_constant< bool, true > true_type
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/template_util.h:89
absl::pointer_traits< T * >::difference_type
std::ptrdiff_t difference_type
Definition: third_party/abseil-cpp/absl/memory/memory.h:404
absl::memory_internal::GetConstPointer
typename T::const_pointer GetConstPointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:273
google::protobuf.internal::false_type
integral_constant< bool, false > false_type
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/template_util.h:90
absl::memory_internal::MakeUniqueResult::scalar
std::unique_ptr< T > scalar
Definition: third_party/abseil-cpp/absl/memory/memory.h:83
absl::memory_internal::GetDifferenceType
typename T::difference_type GetDifferenceType
Definition: third_party/abseil-cpp/absl/memory/memory.h:282
absl::allocator_traits::pointer
memory_internal::ExtractOrT< memory_internal::GetPointer, Alloc, value_type * > pointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:437
absl::memory_internal::RebindFirstArg< Class< T, Args... >, U >::type
Class< U, Args... > type
Definition: third_party/abseil-cpp/absl/memory/memory.h:325
absl::memory_internal::CopyRange
void CopyRange(Allocator &alloc, Iterator destination, InputIterator first, InputIterator last)
Definition: third_party/abseil-cpp/absl/memory/memory.h:678
absl::pointer_traits::element_type
typename memory_internal::ElementType< Ptr >::type element_type
Definition: third_party/abseil-cpp/absl/memory/memory.h:378
absl::pointer_traits::difference_type
memory_internal::ExtractOrT< memory_internal::GetDifferenceType, Ptr, std::ptrdiff_t > difference_type
Definition: third_party/abseil-cpp/absl/memory/memory.h:384
absl::memory_internal::ElementType< T, void_t< typename T::element_type > >::type
typename T::element_type type
Definition: third_party/abseil-cpp/absl/memory/memory.h:316
absl::memory_internal::ExtractOr::type
Default type
Definition: third_party/abseil-cpp/absl/memory/memory.h:257
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
absl::memory_internal::ElementType
Definition: third_party/abseil-cpp/absl/memory/memory.h:310
absl::make_unique
memory_internal::MakeUniqueResult< T >::scalar make_unique(Args &&... args)
Definition: third_party/abseil-cpp/absl/memory/memory.h:168
absl::allocator_traits
Definition: third_party/abseil-cpp/absl/memory/memory.h:427
env.new
def new
Definition: env.py:51
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition: third_party/abseil-cpp/absl/base/config.h:171
absl::allocator_traits::construct
static void construct(Alloc &a, T *p, Args &&... args)
Definition: third_party/abseil-cpp/absl/memory/memory.h:539
absl::allocator_traits::construct_impl
static void construct_impl(char, Alloc &, T *p, Args &&... args)
Definition: third_party/abseil-cpp/absl/memory/memory.h:583
absl::memory_internal::RebindPtr::type
typename RebindFirstArg< T, U >::type type
Definition: third_party/abseil-cpp/absl/memory/memory.h:330
T
#define T(upbtypeconst, upbtype, ctype, default_value)
absl::pointer_traits< T * >::pointer_to
static pointer pointer_to(element_type &r) noexcept
Definition: third_party/abseil-cpp/absl/memory/memory.h:411
absl::memory_internal::RebindFirstArg
Definition: third_party/abseil-cpp/absl/memory/memory.h:320
absl::memory_internal::RebindPtr
Definition: third_party/abseil-cpp/absl/memory/memory.h:329
true
#define true
Definition: setup_once.h:324
google::protobuf.descriptor_pool.Default
def Default()
Definition: bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py:1252
absl::allocator_traits::allocate_impl
static pointer allocate_impl(char, Alloc &a, size_type n, const_void_pointer)
Definition: third_party/abseil-cpp/absl/memory/memory.h:570
absl::memory_internal::RebindAlloc< T, U, true >::type
typename T::template rebind< U >::other type
Definition: third_party/abseil-cpp/absl/memory/memory.h:355
absl::pointer_traits::pointer_to
static pointer pointer_to(element_type &r)
Definition: third_party/abseil-cpp/absl/memory/memory.h:394
absl::memory_internal::GetPropagateOnContainerCopyAssignment
typename T::propagate_on_container_copy_assignment GetPropagateOnContainerCopyAssignment
Definition: third_party/abseil-cpp/absl/memory/memory.h:289
absl::allocator_traits::allocator_type
Alloc allocator_type
Definition: third_party/abseil-cpp/absl/memory/memory.h:428
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition: third_party/abseil-cpp/absl/base/config.h:170
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
absl::memory_internal::RebindAlloc::type
typename RebindFirstArg< T, U >::type type
Definition: third_party/abseil-cpp/absl/memory/memory.h:350
invalid
@ invalid
Definition: base64_test.cc:39
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
absl::allocator_traits::difference_type
memory_internal::ExtractOrT< memory_internal::GetDifferenceType, Alloc, typename absl::pointer_traits< pointer >::difference_type > difference_type
Definition: third_party/abseil-cpp/absl/memory/memory.h:466
absl::allocator_traits::const_pointer
memory_internal::ExtractOrT< memory_internal::GetConstPointer, Alloc, typename absl::pointer_traits< pointer >::template rebind< const value_type > > const_pointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:445
hpack_encoder_fixtures::Args
Args({0, 16384})
array
Definition: undname.c:101
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
absl::RawPtr
auto RawPtr(T &&ptr) -> decltype(std::addressof(*ptr))
Definition: third_party/abseil-cpp/absl/memory/memory.h:197
absl::memory_internal::MakeUniqueResult< T[N]>::invalid
void invalid
Definition: third_party/abseil-cpp/absl/memory/memory.h:91
absl::allocator_traits::is_always_equal
memory_internal::ExtractOrT< memory_internal::GetIsAlwaysEqual, Alloc, typename std::is_empty< Alloc >::type > is_always_equal
Definition: third_party/abseil-cpp/absl/memory/memory.h:499
absl::memory_internal::HasRebindAlloc
constexpr bool HasRebindAlloc(...)
Definition: third_party/abseil-cpp/absl/memory/memory.h:339
absl::memory_internal::GetIsAlwaysEqual
typename T::is_always_equal GetIsAlwaysEqual
Definition: third_party/abseil-cpp/absl/memory/memory.h:299
absl::allocator_traits::select_on_container_copy_construction_impl
static auto select_on_container_copy_construction_impl(int, const A &a) -> decltype(a.select_on_container_copy_construction())
Definition: third_party/abseil-cpp/absl/memory/memory.h:606
absl::allocator_traits::select_on_container_copy_construction
static Alloc select_on_container_copy_construction(const Alloc &a)
Definition: third_party/abseil-cpp/absl/memory/memory.h:559
absl::ShareUniquePtr
std::shared_ptr< T > ShareUniquePtr(std::unique_ptr< T, D > &&ptr)
Definition: third_party/abseil-cpp/absl/memory/memory.h:227
absl::compare_internal::value_type
int8_t value_type
Definition: abseil-cpp/absl/types/compare.h:45
absl::flags_internal::Alloc
void * Alloc(FlagOpFn op)
Definition: abseil-cpp/absl/flags/internal/flag.h:102
absl::allocator_traits::destroy_impl
static auto destroy_impl(int, A &a, T *p) -> decltype(a.destroy(p))
Definition: third_party/abseil-cpp/absl/memory/memory.h:588
absl::pointer_traits::pointer
Ptr pointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:373
absl::allocator_traits::max_size
static size_type max_size(const Alloc &a)
Definition: third_party/abseil-cpp/absl/memory/memory.h:554
absl::pointer_traits< T * >::rebind
U * rebind
Definition: third_party/abseil-cpp/absl/memory/memory.h:407
absl::pointer_traits::rebind
typename memory_internal::RebindPtr< Ptr, U >::type rebind
Definition: third_party/abseil-cpp/absl/memory/memory.h:390
absl::memory_internal::RebindAlloc
Definition: third_party/abseil-cpp/absl/memory/memory.h:349
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
absl::memory_internal::GetConstVoidPointer
typename T::const_void_pointer GetConstVoidPointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:279
absl::memory_internal::GetPointer
typename T::pointer GetPointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:270
absl::WrapUnique
ABSL_NAMESPACE_BEGIN std::unique_ptr< T > WrapUnique(T *ptr)
Definition: third_party/abseil-cpp/absl/memory/memory.h:72
value
const char * value
Definition: hpack_parser_table.cc:165
absl::allocator_traits::const_void_pointer
memory_internal::ExtractOrT< memory_internal::GetConstVoidPointer, Alloc, typename absl::pointer_traits< pointer >::template rebind< const void > > const_void_pointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:459
absl::allocator_traits::allocate_impl
static auto allocate_impl(int, A &a, size_type n, const_void_pointer hint) -> decltype(a.allocate(n, hint))
Definition: third_party/abseil-cpp/absl/memory/memory.h:565
memory_diff.cur
def cur
Definition: memory_diff.py:83
absl::void_t
typename type_traits_internal::VoidTImpl< Ts... >::type void_t
Definition: abseil-cpp/absl/meta/type_traits.h:218
absl::memory_internal::GetPropagateOnContainerMoveAssignment
typename T::propagate_on_container_move_assignment GetPropagateOnContainerMoveAssignment
Definition: third_party/abseil-cpp/absl/memory/memory.h:293
absl::allocator_traits::allocate
static pointer allocate(Alloc &a, size_type n)
Definition: third_party/abseil-cpp/absl/memory/memory.h:514
construct
static std::function< void(void *, Slot *, Slot)> construct
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:41
absl::memory_internal::ConstructRange
void ConstructRange(Allocator &alloc, Iterator first, Iterator last, const Args &... args)
Definition: third_party/abseil-cpp/absl/memory/memory.h:660
N
#define N
Definition: sync_test.cc:37
absl::pointer_traits< T * >::pointer
T * pointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:402
ABSL_INTERNAL_CATCH_ANY
#define ABSL_INTERNAL_CATCH_ANY
Definition: abseil-cpp/absl/base/macros.h:143
ABSL_INTERNAL_TRY
#define ABSL_INTERNAL_TRY
Definition: abseil-cpp/absl/base/macros.h:142
absl::allocator_traits::size_type
memory_internal::ExtractOrT< memory_internal::GetSizeType, Alloc, typename std::make_unsigned< difference_type >::type > size_type
Definition: third_party/abseil-cpp/absl/memory/memory.h:473
absl::memory_internal::ExtractOr
Definition: third_party/abseil-cpp/absl/memory/memory.h:256
absl::memory_internal::ExtractOr< Extract, Obj, Default, void_t< Extract< Obj > > >::type
Extract< Obj > type
Definition: third_party/abseil-cpp/absl/memory/memory.h:262
fix_build_deps.r
r
Definition: fix_build_deps.py:491
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
first
StrT first
Definition: cxa_demangle.cpp:4884
absl::memory_internal::ExtractOrT
typename ExtractOr< Extract, Obj, Default, void >::type ExtractOrT
Definition: third_party/abseil-cpp/absl/memory/memory.h:266
absl::make_unique
memory_internal::MakeUniqueResult< T >::invalid make_unique(Args &&...)=delete
A
Definition: miscompile_with_no_unique_address_test.cc:23
absl::memory_internal::GetSizeType
typename T::size_type GetSizeType
Definition: third_party/abseil-cpp/absl/memory/memory.h:285
absl::allocator_traits::select_on_container_copy_construction_impl
static Alloc select_on_container_copy_construction_impl(char, const Alloc &a)
Definition: third_party/abseil-cpp/absl/memory/memory.h:610
absl::inlined_vector_internal::Iterator
Pointer< A > Iterator
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:64
absl::allocator_traits::allocate
static pointer allocate(Alloc &a, size_type n, const_void_pointer hint)
Definition: third_party/abseil-cpp/absl/memory/memory.h:522
absl::memory_internal::GetVoidPointer
typename T::void_pointer GetVoidPointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:276
absl::remove_extent_t
typename std::remove_extent< T >::type remove_extent_t
Definition: abseil-cpp/absl/meta/type_traits.h:618
absl
Definition: abseil-cpp/absl/algorithm/algorithm.h:31
absl::allocator_traits::void_pointer
memory_internal::ExtractOrT< memory_internal::GetVoidPointer, Alloc, typename absl::pointer_traits< pointer >::template rebind< void > > void_pointer
Definition: third_party/abseil-cpp/absl/memory/memory.h:452
absl::allocator_traits::deallocate
static void deallocate(Alloc &a, pointer p, size_type n)
Definition: third_party/abseil-cpp/absl/memory/memory.h:529
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
setup.template
template
Definition: setup.py:47
absl::allocator_is_nothrow
Definition: third_party/abseil-cpp/absl/memory/memory.h:646
absl::default_allocator_is_nothrow
Definition: third_party/abseil-cpp/absl/memory/memory.h:655
absl::allocator_traits::destroy
static void destroy(Alloc &a, T *p)
Definition: third_party/abseil-cpp/absl/memory/memory.h:547
absl::allocator_traits::rebind_alloc
typename memory_internal::RebindAlloc< Alloc, T >::type rebind_alloc
Definition: third_party/abseil-cpp/absl/memory/memory.h:505
absl::memory_internal::GetIsNothrow
typename Alloc::is_nothrow GetIsNothrow
Definition: third_party/abseil-cpp/absl/memory/memory.h:622
absl::memory_internal::GetFirstArg
Definition: third_party/abseil-cpp/absl/memory/memory.h:302
absl::memory_internal::MakeUniqueResult
Definition: third_party/abseil-cpp/absl/memory/memory.h:82
alloc
std::allocator< int > alloc
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:87
destroy
static std::function< void(void *, Slot *)> destroy
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:42
absl::allocator_traits::max_size_impl
static auto max_size_impl(int, const A &a) -> decltype(a.max_size())
Definition: third_party/abseil-cpp/absl/memory/memory.h:598
ABSL_INTERNAL_RETHROW
#define ABSL_INTERNAL_RETHROW
Definition: abseil-cpp/absl/base/macros.h:144
absl::allocator_traits::destroy_impl
static void destroy_impl(char, Alloc &, T *p)
Definition: third_party/abseil-cpp/absl/memory/memory.h:593
absl::allocator_traits::propagate_on_container_copy_assignment
memory_internal::ExtractOrT< memory_internal::GetPropagateOnContainerCopyAssignment, Alloc, std::false_type > propagate_on_container_copy_assignment
Definition: third_party/abseil-cpp/absl/memory/memory.h:480
absl::allocator_traits::max_size_impl
static size_type max_size_impl(char, const Alloc &)
Definition: third_party/abseil-cpp/absl/memory/memory.h:601
const_pointer
const typedef T * const_pointer
Definition: cxa_demangle.cpp:4833
absl::memory_internal::RebindPtr< T, U, void_t< typename T::template rebind< U > > >::type
typename T::template rebind< U > type
Definition: third_party/abseil-cpp/absl/memory/memory.h:335


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:23