-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have Arena::Create support arena constructible types
Unlike Arena::CreateMessage, Arena::Create creates only the top level object from arena even if it is arena constructalble; e.g. messages, RepeatedPtrField, etc. This renders arenas less effective. Instead of asking users to be aware of such nuances to use the right API for the right type, this CL makes Arena::Create recognizes and fully supports arena constructable types. While extremly rare, some users try to emulate Arena::CreateMessage with Arena::Create by passing arena parameter twice. For example, ``` auto foo = Arena::Create<Foo>(&arena, &arena); // bad ``` This pattern is not supported and will break after this change. The following is recommended instead. ``` auto foo = Arena::CreateMessage<Foo>(&arena); // recommended auto foo = Arena::Create<Foo>(&arena); // after this change ``` PiperOrigin-RevId: 585709990
- Loading branch information
1 parent
df8a449
commit 578e07e
Showing
5 changed files
with
58 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters