Fix containers documentation discrepancies

- Remove Size() from String docs (does not exist in source, use Length())
- Remove broken links to operator+ and operator==/!= (inline functions)
- Fix string.md to correctly reference Length/Capacity/Empty instead of Size
- Add proper documentation for inline operators in string.md
This commit is contained in:
2026-03-19 01:04:10 +08:00
parent 7dd7858ef2
commit 3ac93ba2e8
2 changed files with 5 additions and 8 deletions

View File

@@ -1,8 +1,7 @@
# String::Length / Size / Capacity / Empty
# String::Length / Capacity / Empty
```cpp
SizeType Length() const;
SizeType Size() const;
SizeType Capacity() const;
bool Empty() const;
```
@@ -13,7 +12,6 @@ bool Empty() const;
**返回:**
- `Length()` - 返回字符串的字符数(不包括终止 null 字符)
- `Size()` - 与 `Length()` 功能相同,返回字符串的字符数
- `Capacity()` - 返回已分配的存储容量
- `Empty()` - 如果字符串为空则返回 `true`
@@ -30,7 +28,6 @@ int main() {
XCEngine::Containers::String s2("Hello");
std::cout << "Length: " << s2.Length() << std::endl; // 输出: Length: 5
std::cout << "Size: " << s2.Size() << std::endl; // 输出: Size: 5
std::cout << "Capacity: " << s2.Capacity() << std::endl; // 输出: Capacity: 6 或更大
s2.Reserve(100);