docs: update containers API docs

This commit is contained in:
2026-03-20 02:35:01 +08:00
parent a647f5e8ec
commit 0c073db4e8
33 changed files with 135 additions and 56 deletions

View File

@@ -7,6 +7,10 @@ T& EmplaceBack(Args&&... args);
在数组末尾就地构造一个元素,直接在内存中构造,不产生临时对象。
**容量管理:**
- 如果容量不足(`m_size >= m_capacity`),先扩容
- 当容量为0时首次扩容至4之后每次扩容翻倍即 4 → 8 → 16 → ...
**优势:**
- 避免拷贝或移动开销
- 直接在底层缓冲区末尾构造元素
@@ -29,7 +33,7 @@ struct Vertex {
Vertex(float x_, float y_, float z_) : x(x_), y(y_), z(z_) {}
};
Containers::Array<Vertex> vertices;
XCEngine::Containers::Array<Vertex> vertices;
// EmplaceBack 直接构造,不产生临时 Vertex 对象
vertices.EmplaceBack(1.0f, 2.0f, 3.0f);