[libc-commits] [PATCH] D131377: [libc] Add a utility data structure named ArrayStore.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Aug 8 11:22:42 PDT 2022


sivachandra added inline comments.


================
Comment at: libc/src/__support/arraystore.h:15
+// supports vector like API but is not resizable like a vector.
+template <typename T, size_t SIZE> class ArrayStore {
+  cpp::array<T, SIZE> store;
----------------
michaelrj wrote:
> Currently, there is no way to add or remove elements that aren't at the end of the array. I would say either add `operator[]` or rename this to `ArrayStack`.
> Currently, there is no way to add or remove elements that aren't at the end of the array.

What do you mean "at the end of the array"? This data structure is not to be used like an array. It's internal storage uses an array.

> I would say either add `operator[]` or rename this to `ArrayStack`.

We normally add methods as required. There is no requirement for `operator[]` so it isn't present. Its not clear to me how the presence or absence of that method should affect the name. I am open to a better name though. The name `ArrayStore` was chosen in the same pattern as that of the current `cpp::BlockStore`. Some other languages have similar concepts named `FixedVector`. I can change the name to that if it sounds better.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131377/new/

https://reviews.llvm.org/D131377



More information about the libc-commits mailing list