Skip to content

Commit

Permalink
Add a non-const overload of RepeatedPtrField::GetArena and deprecate …
Browse files Browse the repository at this point in the history
…the const overload.

Motivation: we are planning to make RepeatedPtrField::GetArena non-const in order to support split RepeatedFields.
PiperOrigin-RevId: 507528755
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Feb 6, 2023
1 parent fe0d593 commit 4bf33da
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/google/protobuf/repeated_ptr_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,9 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
iterator erase(const_iterator first, const_iterator last);

// Gets the arena on which this RepeatedPtrField stores its elements.
inline Arena* GetArena();

ABSL_DEPRECATED("This will be removed in a future release")
inline Arena* GetArena() const;

// For internal use only.
Expand Down Expand Up @@ -1544,6 +1547,11 @@ inline void RepeatedPtrField<Element>::SwapElements(int index1, int index2) {
RepeatedPtrFieldBase::SwapElements(index1, index2);
}

template <typename Element>
inline Arena* RepeatedPtrField<Element>::GetArena() {
return RepeatedPtrFieldBase::GetArena();
}

template <typename Element>
inline Arena* RepeatedPtrField<Element>::GetArena() const {
return RepeatedPtrFieldBase::GetArena();
Expand Down

0 comments on commit 4bf33da

Please sign in to comment.