template <typename T>

class RepeatedPtrField

Defined at line 1200 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

RepeatedPtrField is like RepeatedField, but used for repeated strings or

Messages.

Public Methods

void RepeatedPtrField<T> (internal::InternalVisibility , internal::InternalMetadataOffset offset)

Arena enabled constructors: for internal use only.

Defined at line 1244 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void RepeatedPtrField<T> (internal::InternalVisibility , internal::InternalMetadataOffset offset, const RepeatedPtrField<Element> & rhs)

Defined at line 1247 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void RepeatedPtrField<T> (const RepeatedPtrField<Element> & rhs)

Defined at line 1257 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void RepeatedPtrField<T> (RepeatedPtrField<Element> && rhs)

Defined at line 1262 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void Add (const Element & value)

Copying to the end of this RepeatedPtrField is slowest of all; it can't

reliably copy-construct to the last element of this RepeatedPtrField, for

example (unlike std::vector).

We currently block this API. The right way to add to the end is to call

Add() and modify the element it points to.

If you must add an existing value, call `*Add() = value;`

Defined at line 1296 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_reference operator[] (int index)

Defined at line 1315 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

reference operator[] (int index)

Defined at line 1319 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

reverse_iterator rbegin ()

Defined at line 1389 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_reverse_iterator rbegin ()

Defined at line 1393 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

reverse_iterator rend ()

Defined at line 1397 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_reverse_iterator rend ()

Defined at line 1401 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

int SpaceUsedExcludingSelf ()

Defined at line 1419 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void InternalSwap (RepeatedPtrField<Element> *__restrict other)

For internal use only.

This is public due to it being called by generated code.

Defined at line 1515 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void RepeatedPtrField<T> ()

-------------------------------------------------------------------

Defined at line 1624 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

template <typename Iter, typename = typename std::enable_if<std::is_constructible<
                                    Element, decltype(*std::declval<Iter>())>::value>::type>
void RepeatedPtrField<T> (Iter begin, Iter end)

Defined at line 1650 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

RepeatedPtrField<Element> & operator= (const RepeatedPtrField<Element> & other)

Defined at line 1692 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

RepeatedPtrField<Element> & operator= (RepeatedPtrField<Element> && other)

Defined at line 1713 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void ~RepeatedPtrField<T> ()

Defined at line 1658 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

bool empty ()

Defined at line 1730 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

int size ()

Defined at line 1735 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_reference Get (int index)

Defined at line 1740 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

pointer Mutable (int index)

Defined at line 1758 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

pointer Add ()

Unlike std::vector, adding an element to a RepeatedPtrField doesn't always

make a new element; it might re-use an element left over from when the

field was Clear()'d or resize()'d smaller. For this reason, Add() is the

fastest API for adding a new element.

Defined at line 1764 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void Add (Element && value)

`Add(std::move(value));` is equivalent to `*Add() = std::move(value);`

It will either move-construct to the end of this field, or swap value

with the new-or-recycled element at the end of this field. Note that

this operation is very slow if this RepeatedPtrField is not on the

same Arena, if any, as `value`.

Defined at line 1782 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

template <typename Iter>
void Add (Iter begin, Iter end)

Append elements in the range [begin, end) after reserving

the appropriate number of elements.

Defined at line 1813 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void resize (size_type new_size)

If `new_size

<

size()`, truncate the container, destroying the removed

elements.

If `new_size > size()`, add value-initialized elements to reach the desired

size.

Defined at line 1669 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void resize (size_type new_size, CopyConstructReferenceType value)

If `new_size

<

size()`, truncate the container, destroying the removed

elements.

If `new_size > size()`, add copies of `value` elements to reach the desired

size.

Defined at line 1677 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_reference at (int index)

Defined at line 1746 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

reference at (int index)

Defined at line 1752 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void RemoveLast ()

Removes the last element in the array.

Ownership of the element is retained by the array.

Defined at line 1835 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void DeleteSubrange (int start, int num)

Deletes elements with indices in the range [start .. start+num-1].

Caution: moves all elements with indices [start+num .. ].

Calling this routine inside a loop can cause quadratic behavior.

Defined at line 1840 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void Clear ()

Defined at line 1917 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void MergeFrom (const RepeatedPtrField<Element> & other)

Appends the elements from `other` after this instance.

The end result length will be `other.size() + this->size()`.

Defined at line 1922 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void CopyFrom (const RepeatedPtrField<Element> & other)

Replaces the contents with a copy of the elements from `other`.

Defined at line 1936 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

template <typename Iter>
void Assign (Iter begin, Iter end)

Replaces the contents with RepeatedPtrField(begin, end).

Defined at line 1941 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void Reserve (int new_size)

Reserves space to expand the field to at least the given size. This only

resizes the pointer array; it doesn't allocate any objects. If the

array is grown, it will always be at least doubled in size.

Defined at line 2058 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

int Capacity ()

Defined at line 2063 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

Element ** mutable_data ()

Gets the underlying array. This pointer is possibly invalidated by

any add or remove operation.

Defined at line 1965 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const Element *const * data ()

Defined at line 1971 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void Swap (RepeatedPtrField<Element> * other)

Swaps entire contents with "other". If they are on separate arenas, then

copies data.

Defined at line 1977 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void UnsafeArenaSwap (RepeatedPtrField<Element> * other)

Swaps entire contents with "other". Caller should guarantee that either

both fields are on the same arena or both are on the heap. Swapping between

different arenas with this function is disallowed and is caught via

ABSL_DCHECK.

Defined at line 1983 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void SwapElements (int index1, int index2)

Swaps two elements.

Defined at line 1991 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

iterator begin ()

Defined at line 2398 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_iterator begin ()

Defined at line 2403 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_iterator cbegin ()

Defined at line 2408 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

iterator end ()

Defined at line 2413 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_iterator end ()

Defined at line 2418 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_iterator cend ()

Defined at line 2423 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

pointer_iterator pointer_begin ()

Defined at line 2429 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_pointer_iterator pointer_begin ()

Defined at line 2434 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

pointer_iterator pointer_end ()

Defined at line 2439 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

const_pointer_iterator pointer_end ()

Defined at line 2444 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

size_t SpaceUsedExcludingSelfLong ()

Returns (an estimate of) the number of bytes used by the repeated field,

excluding sizeof(*this).

Defined at line 2008 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void AddAllocated (Element * value)

Adds an already-allocated object, passing ownership to the

RepeatedPtrField.

Note that some special behavior occurs with respect to arenas:

(i) if this field holds submessages, the new submessage will be copied if

the original is in an arena and this RepeatedPtrField is either in a

different arena, or on the heap.

(ii) if this field holds strings, the passed-in string *must* be

heap-allocated, not arena-allocated. There is no way to dynamically check

this at runtime, so User Beware.

Requires: value != nullptr

Defined at line 2019 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

Element * ReleaseLast ()

Removes and returns the last element, passing ownership to the caller.

Requires: size() > 0

If this RepeatedPtrField is on an arena, an object copy is required to pass

ownership back to the user (for compatible semantics). Use

UnsafeArenaReleaseLast() if this behavior is undesired.

Defined at line 2043 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void UnsafeArenaAddAllocated (Element * value)

Adds an already-allocated object, skipping arena-ownership checks. The user

must guarantee that the given object is in the same arena as this

RepeatedPtrField.

It is also useful in legacy code that uses temporary ownership to avoid

copies. Example:

RepeatedPtrField

<T

> temp_field;

temp_field.UnsafeArenaAddAllocated(new T);

... // Do something with temp_field

temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr);

If you put temp_field on the arena this fails, because the ownership

transfers to the arena at the "AddAllocated" call and is not released

anymore, causing a double delete. UnsafeArenaAddAllocated prevents this.

Requires: value != nullptr

Defined at line 2031 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

pointer UnsafeArenaReleaseLast ()

Removes and returns the last element. Unlike ReleaseLast, the returned

pointer is always to the original object. This may be in an arena, in

which case it would have the arena's lifetime.

Requires: current_size_ > 0

Defined at line 2053 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void ExtractSubrange (int start, int num, Element ** elements)

Extracts elements with indices in the range "[start .. start+num-1]".

The caller assumes ownership of the extracted elements and is responsible

for deleting them when they are no longer needed.

If "elements" is non-nullptr, then pointers to the extracted elements

are stored in "elements[0 .. num-1]" for the convenience of the caller.

If "elements" is nullptr, then the caller must use some other mechanism

to perform any further operations (like deletion) on these elements.

Caution: implementation also moves elements with indices [start+num ..].

Calling this routine inside a loop can cause quadratic behavior.

Memory copying behavior is identical to ReleaseLast(), described above: if

this RepeatedPtrField is on an arena, an object copy is performed for each

returned element, so that all returned element pointers are to

heap-allocated copies. If this copy is not desired, the user should call

UnsafeArenaExtractSubrange().

Defined at line 1855 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void UnsafeArenaExtractSubrange (int start, int num, Element ** elements)

Identical to ExtractSubrange() described above, except that no object

copies are ever performed. Instead, the raw object pointers are returned.

Thus, if on an arena, the returned objects must not be freed, because they

will not be heap-allocated objects.

Defined at line 1901 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

iterator erase (const_iterator position)

Removes the element referenced by position.

Returns an iterator to the element immediately following the removed

element.

Invalidates all iterators at or after the removed element, including end().

Defined at line 1948 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

iterator erase (const_iterator first, const_iterator last)

Removes the elements in the range [first, last).

Returns an iterator to the element immediately following the removed range.

Invalidates all iterators at or after the removed range, including end().

Defined at line 1955 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

Arena * GetArena ()

Gets the arena on which this RepeatedPtrField stores its elements.

Defined at line 1996 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

pointer InternalAddWithArena (internal::InternalVisibility , Arena * arena)

For internal use only.

Like `Add()`, but uses the given arena instead of calling `GetArena()`. It

is the responsibility of the caller to ensure that this arena is the same

as the arena returned from `GetArena()`.

Defined at line 1770 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void InternalAddWithArena (internal::InternalVisibility , Arena * arena, Element && value)

For internal use only.

Like `Add(Element

&

&

)`, but uses the given arena instead of calling

`GetArena()`. It is the responsibility of the caller to ensure that this

arena is the same as the arena returned from `GetArena()`.

Defined at line 1787 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

void InternalMergeFromWithArena (internal::InternalVisibility , Arena * arena, const RepeatedPtrField<Element> & other)

For internal use only.

Like `MergeFrom(const RepeatedPtrField

&

other)`, but uses the given arena

instead of calling `GetArena()`. It is the responsibility of the caller to

ensure that this arena is the same as the arena returned from `GetArena()`.

Defined at line 1929 of file ../../third_party/protobuf/src/src/google/protobuf/repeated_ptr_field.h

Friends

template <typename T>
class MapFieldBase
template <typename T>
class WeakRepeatedPtrField
template <typename ElementType>
class RepeatedFieldProxy
template <typename T>
class TcParser
template <typename T>
class MapFieldBase
template <typename T>
class ExtensionSet
template <typename T>
class Reflection
template <typename T>
class DynamicMessage
template <typename T>
class Arena
template <typename T>
class RepeatedPtrFieldTest
template <typename T>
class AllocatedRepeatedPtrFieldBackInsertIterator
template <typename T>
class RepeatedPtrFieldBackInsertIterator