2026-03-26 18:02:29 +08:00
|
|
|
# ProxyAllocator::Constructor
|
2026-03-26 16:45:24 +08:00
|
|
|
|
2026-03-26 18:02:29 +08:00
|
|
|
构造一个代理分配器。
|
2026-03-26 16:45:24 +08:00
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
ProxyAllocator(IAllocator* underlying, const char* name);
|
|
|
|
|
```
|
|
|
|
|
|
2026-03-26 18:02:29 +08:00
|
|
|
## 行为说明
|
2026-03-26 16:45:24 +08:00
|
|
|
|
2026-03-26 18:02:29 +08:00
|
|
|
当前构造函数只做成员保存:
|
2026-03-26 16:45:24 +08:00
|
|
|
|
2026-03-26 18:02:29 +08:00
|
|
|
- `m_underlying = underlying`
|
|
|
|
|
- `m_name = name`
|
2026-03-26 16:45:24 +08:00
|
|
|
|
2026-03-26 18:02:29 +08:00
|
|
|
它不会复制名称字符串,也不会接管底层分配器所有权。
|
2026-03-26 16:45:24 +08:00
|
|
|
|
2026-03-26 18:02:29 +08:00
|
|
|
## 参数
|
2026-03-26 16:45:24 +08:00
|
|
|
|
2026-03-26 18:02:29 +08:00
|
|
|
- `underlying` - 被代理的底层分配器。
|
|
|
|
|
- `name` - 代理名称。
|
|
|
|
|
|
|
|
|
|
## 返回值
|
|
|
|
|
|
|
|
|
|
- 无。
|
|
|
|
|
|
|
|
|
|
## 当前实现限制
|
|
|
|
|
|
|
|
|
|
- 不校验 `underlying` 是否为空。
|
|
|
|
|
- 不复制 `name` 内容,只保存原始指针。
|
|
|
|
|
- 调用方必须保证底层分配器和名称字符串在 `ProxyAllocator` 生命周期内保持有效。
|
2026-03-26 16:45:24 +08:00
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
2026-03-26 18:02:29 +08:00
|
|
|
- [返回类型总览](ProxyAllocator.md)
|
|
|
|
|
- [GetName](GetName.md)
|