Files
XCSDD/docs/api/containers/string/operator-plus.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

972 B

operator+

inline String operator+(const String& lhs, const String& rhs);

将两个 String 对象连接,返回一个新的 String 对象。

参数:

  • lhs - 左侧的 String 对象
  • rhs - 右侧的 String 对象

返回: 新的 String 对象,内容为 lhs 和 rhs 的拼接

复杂度: O(n + m),其中 n 和 m 分别为 lhs 和 rhs 的长度

示例:

#include "XCEngine/Containers/String.h"
#include <iostream>

int main() {
    XCEngine::Containers::String s1("Hello");
    XCEngine::Containers::String s2(" World");
    XCEngine::Containers::String s3 = s1 + s2;

    std::cout << s3.CStr() << std::endl;  // 输出: Hello World

    XCEngine::Containers::String s4 = XCEngine::Containers::String("Foo") + "Bar";
    std::cout << s4.CStr() << std::endl;  // 输出: FooBar

    return 0;
}

相关文档