You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I locally tested that, it seems like the memory footprint of std::inplace_vector is N * sizeof(T) + size_t, aka the raw underlying storage plus a size. But I wasn't sure if all standard implementation follows this convention. If you can find the cpp reference for this, feel free to add this point to the tutorial as well.
std::inplace_vector is a dynamically-resizable array with contiguous inplace storage. The elements of type T are stored and properly aligned within the object itself. The capacity of the internal storage is fixed at compile-time and is equal to N.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief: improve the code sample for
std::inplace_vectorsection.Since the tutorial is explicitly mentioning
a.
b.
It's worthwhile to show these two points in the code sample.
QA:
see godbolt link https://godbolt.org/z/K78EnTnYM
BTW:
I locally tested that, it seems like the memory footprint of
std::inplace_vectorisN * sizeof(T) + size_t, aka the raw underlying storage plus a size. But I wasn't sure if all standard implementation follows this convention. If you can find the cpp reference for this, feel free to add this point to the tutorial as well.@Charliechen114514