Go to the documentation of this file.
35 #ifndef ABSL_CONTAINER_INLINED_VECTOR_H_
36 #define ABSL_CONTAINER_INLINED_VECTOR_H_
42 #include <initializer_list>
45 #include <type_traits>
48 #include "absl/algorithm/algorithm.h"
49 #include "absl/base/internal/throw_delegate.h"
50 #include "absl/base/macros.h"
51 #include "absl/base/optimization.h"
52 #include "absl/base/port.h"
53 #include "absl/container/internal/inlined_vector.h"
54 #include "absl/memory/memory.h"
68 template <
typename T,
size_t N,
typename A = std::allocator<T>>
70 static_assert(
N > 0,
"`absl::InlinedVector` requires an inlined capacity.");
74 template <
typename TheA>
76 template <
typename TheA>
78 template <
typename TheA>
81 template <
typename TheA,
typename Iterator>
84 template <
typename TheA>
86 template <
typename TheA>
90 template <
typename Iterator>
93 template <
typename Iterator>
148 template <
typename ForwardIterator,
149 EnableIfAtLeastForwardIterator<ForwardIterator> = 0>
154 static_cast<size_t>(std::distance(
first, last)));
159 template <
typename InputIterator,
160 DisableIfAtLeastForwardIterator<InputIterator> = 0>
207 other.storage_.SetInlinedSize(0);
208 }
else if (other.storage_.GetIsAllocated()) {
210 other.storage_.GetAllocatedCapacity()});
213 other.storage_.SetInlinedSize(0);
218 inlined_vector_internal::ConstructElements<A>(
220 other.storage_.GetSize());
241 other.storage_.SetInlinedSize(0);
243 other.storage_.GetIsAllocated()) {
245 other.storage_.GetAllocatedCapacity()});
248 other.storage_.SetInlinedSize(0);
341 "`InlinedVector::at(size_type)` failed bounds check");
354 "`InlinedVector::at(size_type) const` failed bounds check");
464 assign(list.begin(), list.end());
474 assign(other_data, other_data + other.
size());
493 other.storage_.SetInlinedSize(0);
513 void assign(std::initializer_list<value_type> list) {
514 assign(list.begin(), list.end());
521 template <
typename ForwardIterator,
522 EnableIfAtLeastForwardIterator<ForwardIterator> = 0>
525 static_cast<size_t>(std::distance(
first, last)));
532 template <
typename InputIterator,
533 DisableIfAtLeastForwardIterator<InputIterator> = 0>
536 for (; i < size() && first != last; ++i, static_cast<void>(++
first)) {
593 #if !defined(__clang__) && defined(__GNUC__)
594 #pragma GCC diagnostic push
595 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
599 #if !defined(__clang__) && defined(__GNUC__)
600 #pragma GCC diagnostic pop
611 return insert(
pos, list.begin(), list.end());
619 template <
typename ForwardIterator,
620 EnableIfAtLeastForwardIterator<ForwardIterator> = 0>
622 ForwardIterator last) {
629 std::distance(
first, last));
640 template <
typename InputIterator,
641 DisableIfAtLeastForwardIterator<InputIterator> = 0>
658 template <
typename...
Args>
674 template <
typename...
Args>
771 template <
typename H,
typename TheT,
size_t TheN,
typename TheA>
784 template <
typename T,
size_t N,
typename A>
793 template <
typename T,
size_t N,
typename A>
796 auto a_data =
a.data();
797 auto b_data =
b.data();
798 return absl::equal(a_data, a_data +
a.size(), b_data, b_data +
b.size());
804 template <
typename T,
size_t N,
typename A>
814 template <
typename T,
size_t N,
typename A>
817 auto a_data =
a.data();
818 auto b_data =
b.data();
819 return std::lexicographical_compare(a_data, a_data +
a.size(), b_data,
827 template <
typename T,
size_t N,
typename A>
837 template <
typename T,
size_t N,
typename A>
847 template <
typename T,
size_t N,
typename A>
857 template <
typename H,
typename T,
size_t N,
typename A>
859 auto size =
a.size();
866 #endif // ABSL_CONTAINER_INLINED_VECTOR_H_
#define ABSL_PREDICT_FALSE(x)
allocator_type get_allocator() const
H AbslHashValue(H h, const absl::InlinedVector< T, N, A > &a)
const_iterator begin() const noexcept
iterator erase(const_iterator from, const_iterator to)
Pointer< A > GetInlinedData()
void Swap(Storage *other_storage_ptr)
size_type capacity() const noexcept
reference emplace_back(Args &&... args)
reverse_iterator rbegin() noexcept
reverse_iterator rend() noexcept
iterator insert(const_iterator pos, value_type &&v)
void assign(std::initializer_list< value_type > list)
InlinedVector & operator=(std::initializer_list< value_type > list)
SizeType< A > GetAllocatedCapacity() const
void MemcpyFrom(const Storage &other_storage)
void Reserve(SizeType< A > requested_capacity)
static int copy(grpc_slice_buffer *input, grpc_slice_buffer *output)
inlined_vector_internal::Iterator< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > iterator
const_reverse_iterator crend() const noexcept
SizeType< A > GetInlinedCapacity() const
inlined_vector_internal::ConstReverseIterator< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > const_reverse_iterator
std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > allocator_type
const_reverse_iterator rbegin() const noexcept
typename AllocatorTraits< A >::value_type ValueType
absl::enable_if_t< inlined_vector_internal::IsAtLeastForwardIterator< Iterator >::value, int > EnableIfAtLeastForwardIterator
InlinedVector & operator=(const InlinedVector &other)
typename std::enable_if< B, T >::type enable_if_t
size_type max_size() const noexcept
void DestroyElements(AllocatorType *alloc_ptr, Pointer destroy_first, SizeType destroy_size)
Iterator< A > Insert(ConstIterator< A > pos, ValueAdapter values, SizeType< A > insert_count)
#define ABSL_NAMESPACE_END
void resize(size_type n, const_reference v)
InlinedVector(size_type n, const allocator_type &allocator=allocator_type())
reference at(size_type i)
bool operator>(const absl::InlinedVector< T, N, A > &a, const absl::InlinedVector< T, N, A > &b)
#define ABSL_HARDENING_ASSERT(expr)
const_reverse_iterator crbegin() const noexcept
void Assign(ValueAdapter values, SizeType< A > new_size)
iterator insert(const_iterator pos, ForwardIterator first, ForwardIterator last)
iterator erase(const_iterator pos)
const_reference operator[](size_type i) const
void SubtractSize(SizeType< A > count)
InlinedVector(std::initializer_list< value_type > list, const allocator_type &allocator=allocator_type())
const_reference back() const
InlinedVector(const InlinedVector &other)
bool GetIsAllocated() const
void ThrowStdOutOfRange(const std::string &what_arg)
Pointer< A > GetAllocatedData()
iterator begin() noexcept
void SetInlinedSize(SizeType< A > size)
#define ABSL_NAMESPACE_BEGIN
InlinedVector() noexcept(noexcept(allocator_type()))
const_reference at(size_type i) const
InlinedVector(size_type n, const_reference v, const allocator_type &allocator=allocator_type())
const_reverse_iterator rend() const noexcept
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
InlinedVector(ForwardIterator first, ForwardIterator last, const allocator_type &allocator=allocator_type())
Iterator< A > Erase(ConstIterator< A > from, ConstIterator< A > to)
void DeallocateIfAllocated()
const_pointer data() const noexcept
inlined_vector_internal::AllocatorTraits< TheA > AllocatorTraits
ConstPointer< A > ConstIterator
typename AllocatorTraits< A >::const_pointer ConstPointer
inlined_vector_internal::ValueType< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > value_type
inlined_vector_internal::ReverseIterator< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > reverse_iterator
typename std::reverse_iterator< ConstIterator< A > > ConstReverseIterator
void swap(btree_map< K, V, C, A > &x, btree_map< K, V, C, A > &y)
iterator insert(const_iterator pos, std::initializer_list< value_type > list)
iterator insert(const_iterator pos, size_type n, const_reference v)
InlinedVector & operator=(InlinedVector &&other)
void push_back(const_reference v)
typename AllocatorTraits< A >::pointer Pointer
bool equal(InputIter1 first1, InputIter1 last1, InputIter2 first2, InputIter2 last2, Pred &&pred)
inlined_vector_internal::Pointer< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > pointer
void assign(ForwardIterator first, ForwardIterator last)
bool operator==(const absl::InlinedVector< T, N, A > &a, const absl::InlinedVector< T, N, A > &b)
size_type size() const noexcept
const_iterator cbegin() const noexcept
inlined_vector_internal::ConstPointer< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > const_pointer
inlined_vector_internal::DifferenceType< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > difference_type
const_iterator cend() const noexcept
iterator insert(const_iterator pos, const_reference v)
void assign(InputIterator first, InputIterator last)
InlinedVector(const allocator_type &allocator) noexcept
bool operator!=(const absl::InlinedVector< T, N, A > &a, const absl::InlinedVector< T, N, A > &b)
#define ABSL_PREDICT_TRUE(x)
ABSL_ATTRIBUTE_NOINLINE void InitFrom(const Storage &other)
void push_back(value_type &&v)
const_iterator end() const noexcept
const_reference front() const
void swap(InlinedVector &other)
typename std::reverse_iterator< Iterator< A > > ReverseIterator
std::allocator_traits< A > AllocatorTraits
iterator insert(const_iterator pos, InputIterator first, InputIterator last)
void SetAllocatedSize(SizeType< A > size)
SizeType< A > GetSize() const
inlined_vector_internal::ConstReference< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > const_reference
bool operator>=(const absl::InlinedVector< T, N, A > &a, const absl::InlinedVector< T, N, A > &b)
InlinedVector(const InlinedVector &other, const allocator_type &allocator)
void reserve(size_type n)
bool operator<=(const absl::InlinedVector< T, N, A > &a, const absl::InlinedVector< T, N, A > &b)
absl::enable_if_t< !inlined_vector_internal::IsAtLeastForwardIterator< Iterator >::value, int > DisableIfAtLeastForwardIterator
ValueType< A > & Reference
inlined_vector_internal::Reference< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > reference
void Initialize(ValueAdapter values, SizeType< A > new_size)
reference operator[](size_type i)
InlinedVector(InputIterator first, InputIterator last, const allocator_type &allocator=allocator_type())
void assign(size_type n, const_reference v)
InlinedVector(InlinedVector &&other) noexcept(absl::allocator_is_nothrow< allocator_type >::value||std::is_nothrow_move_constructible< value_type >::value)
inlined_vector_internal::SizeType< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > size_type
Reference< A > EmplaceBack(Args &&... args)
void SetAllocation(Allocation< A > allocation)
void Resize(ValueAdapter values, SizeType< A > new_size)
friend H AbslHashValue(H h, const absl::InlinedVector< TheT, TheN, TheA > &a)
inlined_vector_internal::ConstIterator< std::allocator< grpc_core::RefCountedPtr< grpc_core::Handshaker > > > const_iterator
typename std::move_iterator< Iterator< A > > MoveIterator
bool empty() const noexcept
const ValueType< A > & ConstReference
bool operator<(const absl::InlinedVector< T, N, A > &a, const absl::InlinedVector< T, N, A > &b)
inlined_vector_internal::MoveIterator< TheA > MoveIterator
iterator emplace(const_iterator pos, Args &&... args)
InlinedVector(InlinedVector &&other, const allocator_type &allocator) noexcept(absl::allocator_is_nothrow< allocator_type >::value)
std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::forward_iterator_tag > IsAtLeastForwardIterator
static std::function< void(void *, Slot *)> destroy
typename AllocatorTraits< A >::difference_type DifferenceType
typename AllocatorTraits< A >::size_type SizeType
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:03