-
Notifications
You must be signed in to change notification settings - Fork 4
Adding VariableLengthArray and PMR namespace #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Providing a polyfill of much of the pmr namespace for C++14. Adding VariableLengthArray as an allocator-aware vector. CETL's VLA differs from vector in three respects: 1. it supports the CETL-specific reallocation extension to PMR::memory_resource 2. it will tightly fit into a maximum size when elements are pushed without calling reserve first. 3. it avoids undefined behaviour when exceptions are disabled. An unintended benefit: this works with C++17/AppleClang which does not support PMR.
|
Is there some place on the web where the docs could be deployed for review? |
I fixed the CI enough that the latest run uploaded an archive of the docs. Also: The CI revealed that std::vector can refuse to shrink_to_fit when exceptions are disabled. I'll need to fixup the tests to account for this. |
pavel-kirienko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I would strongly prefer to have
VariableLengthArray::at(std::size_t)defined similarly to https://github.com/OpenCyphal/nunavut/blob/f0cc6cdd7ab665b7d2612872339ec35cd560e278/src/nunavut/lang/cpp/support/variable_length_array.hpp#L1330C49-L1353. Both for the main template and itsboolspecialization. - Doc pages omit the full path to header files; the resulting
#includedirective is invalid. Example:

Not sure I understand the purpose of clang-format-check.py when the same could be achieved in fewer lines of code via a custom cmake target (unless I'm missing something), but I presume it is comparatively unimportant. I mostly skipped all of the copious scaffolding and focused on the docs & code.
Do tell! I'd love to get rid of this if I could but I didn't want to try to parse xml in cmake. |
Sorry, but I'm not going to put a production |
|
I normally use https://github.com/marketplace/actions/clang-format-lint together with a |
How about the old std::optional<reference> at_or_null(const size_type);
std::optional<const_reference> at_or_null(const size_type) const; |
Yes. I was planning on doing that when I added optional to CETL. |
cbe92b5 to
8bb10b7
Compare
9a2252c to
227330d
Compare
Fixing CI to properly report test coverage and to actually execute the compile tests.
227330d to
18c80d1
Compare
|
@pavel-kirienko ? Can you approve? |
|
Kudos, SonarCloud Quality Gate passed! |









Providing a polyfill of much of the pmr namespace for C++14.
Adding VariableLengthArray as an allocator-aware vector. CETL's VLA differs from vector in three respects:
An unintended benefit: this works with C++17/AppleClang which does not support PMR.
Reviewer Notes
As always, feel free to skip the vscode/cmake stuff. There was a major refactor of this as I learned more about cmake and I enabled sharing modules with dependent projects (i.e. libcyphal).
This is a huge change. Sorry. Circumstances prevented me from getting PMR in before VLA. If the review is too daunting I can split it up into three stages but it would take some time to get each building independently. One way to make this easier is to review everything under the PMR namespace first and ignore VLA to start with then come back to the VLA.
There are known missing comments, unittests, and CI fix-ups that I'll be working on in parallel.