Files
XCEngine/docs/api/containers/hashmap/setallocator.md
ssdfasd 12ae6f561a 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==/!=
2026-03-19 01:14:20 +08:00

29 lines
581 B
Markdown

# HashMap::SetAllocator
```cpp
void SetAllocator(Memory::IAllocator* allocator);
```
设置哈希表的内存分配器。
**参数:**
- `allocator` - 内存分配器指针,可以为 `nullptr`(使用默认分配器)
**返回:**
**复杂度:** O(1)
**示例:**
```cpp
XCEngine::Containers::HashMap<int, const char*> map;
// 设置自定义分配器(如果使用内存分配器接口)
// map.SetAllocator(customAllocator);
```
## 相关文档
- [HashMap 总览](hashmap.md) - 返回类总览
- [Memory 模块](../../memory/memory.md) - 内存分配器