Skip to content

Commit

Permalink
Adding documentation to CopyFrom and MergeFrom of RepeatedField
Browse files Browse the repository at this point in the history
… and `RepeatedPtrField`.

PiperOrigin-RevId: 652723222
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jul 16, 2024
1 parent d911161 commit 81bd799
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/google/protobuf/repeated_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,12 @@ class RepeatedField final
void ExtractSubrange(int start, int num, Element* elements);

ABSL_ATTRIBUTE_REINITIALIZES void Clear();

// Appends the elements from `other` after this instance.
// The end result length will be `other.size() + this->size()`.
void MergeFrom(const RepeatedField& other);

// Replaces the contents with a copy of the elements from `other`.
ABSL_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedField& other);

// Replaces the contents with RepeatedField(begin, end).
Expand Down
5 changes: 5 additions & 0 deletions src/google/protobuf/repeated_ptr_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,12 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
void DeleteSubrange(int start, int num);

ABSL_ATTRIBUTE_REINITIALIZES void Clear();

// Appends the elements from `other` after this instance.
// The end result length will be `other.size() + this->size()`.
void MergeFrom(const RepeatedPtrField& other);

// Replaces the contents with a copy of the elements from `other`.
ABSL_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other);

// Replaces the contents with RepeatedPtrField(begin, end).
Expand Down

0 comments on commit 81bd799

Please sign in to comment.