[clang] Introduce paged vector (PR #66430)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 01:54:37 PDT 2023


================
@@ -1625,6 +1625,35 @@ SmallVector has grown a few other minor advantages over std::vector, causing
    and is no longer "private to the implementation". A name like
    ``SmallVectorHeader`` might be more appropriate.
 
+.. _dss_smallvector:
+
+llvm/ADT/PagedVector.h
+^^^^^^^^^^^^^^^^^^^^^^
+
+``PagedVector<Type, PageSize>`` is a random access container that allocates (PageSize) elements
+of type Type when the first element of a page is accessed via the ``operator[]`` or the ``at()``
+method.  This is useful for the case in which the number of elements is known in advance and 
+their actual initialization is expensive and sparse so that it's only done lazily when the element is 
+accessed. Typical cases for this are the ASTReader::TypesLoaded and ASTReader::DeclsLoaded containers.
----------------
ChuanqiXu9 wrote:

Same with the opinion in PagedVector.h

https://github.com/llvm/llvm-project/pull/66430


More information about the cfe-commits mailing list