docs: Fix containers module documentation discrepancies

- Array::SetAllocator: Remove reference to non-existent PoolAllocator class
- HashMap::SetAllocator: Remove reference to non-existent GetDefaultAllocator()
- HashMap::Copy/Move: Fix move constructor complexity (O(m_bucketCount), not O(1))
- HashMap::iterator: Remove C++20 structured bindings example
- String: Add missing links for operator+ and operator==/!=
This commit is contained in:
2026-03-19 01:14:20 +08:00
parent 2141534995
commit 12ae6f561a
5 changed files with 7 additions and 17 deletions

View File

@@ -27,7 +27,7 @@ auto* linear = new Memory::LinearAllocator(1024 * 1024);
Containers::Array<int> arr;
arr.SetAllocator(linear);
// 使用内存池分配器
// 使用对象池分配器
auto* pool = new Memory::PoolAllocator(sizeof(MyObject), 100);
Containers::Array<MyObject> objects;
objects.SetAllocator(pool);

View File

@@ -14,7 +14,7 @@ HashMap(HashMap&& other) noexcept;
**复杂度:**
- 拷贝构造O(m_bucketCount + other.m_size)
- 移动构造O(1),直接接管源对象的内部资源
- 移动构造O(m_bucketCount),移动构造需要遍历所有桶以重新建立桶的指针关系
**示例:**

View File

@@ -27,16 +27,6 @@ for (auto it = map.begin(); it != map.end(); ++it) {
std::cout << it->first << " -> " << it->second << std::endl;
}
// 输出顺序不确定,取决于哈希桶的内部布局
// 范围 for 循环(需要 C++20 或手动实现 begin/end
for (auto& [key, value] : map) {
std::cout << key << " -> " << value << std::endl;
}
// 常量迭代器
for (auto it = map.begin(); it != map.end(); ++it) {
std::cout << it->first << " -> " << it->second << std::endl;
}
```
## 相关文档

View File

@@ -18,8 +18,8 @@ void SetAllocator(Memory::IAllocator* allocator);
```cpp
XCEngine::Containers::HashMap<int, const char*> map;
auto customAllocator = XCEngine::Memory::GetDefaultAllocator();
map.SetAllocator(customAllocator);
// 设置自定义分配器(如果使用内存分配器接口)
// map.SetAllocator(customAllocator);
```
## 相关文档

View File

@@ -37,14 +37,14 @@
| 方法 | 描述 |
|------|------|
| [operator+=](operator-plus-assign.md) | 追加字符串/字符 |
| operator+ | 字符串连接 |
| [operator+](../string/operator-plus.md) | 字符串连接 |
### 比较运算符
| 方法 | 描述 |
|------|------|
| operator== | 判断两个字符串是否相等 |
| operator!= | 判断两个字符串是否不相等 |
| [operator==](../string/operator-equal.md) | 判断两个字符串是否相等 |
| [operator!=](../string/operator-equal.md) | 判断两个字符串是否不相等 |
### 字符串操作