We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basic_string.h
\0
L\0
const
capacity()
1
rhs.size() <= this->capacity()
operator+
The text was updated successfully, but these errors were encountered:
No branches or pull requests
逻辑问题
\0
、L\0
等)的设置是惰性的。这与标准要求不合,并且可能有并发调用const
限定函数导致数据竞争的问题;capacity()
的返回值应该是当前分配的存储中能放下的字符串元素数,元素不含末尾的空终止符(此处与 Jonathan Wakely 确认过)。所以目前实现的值多了1
。优化问题
rhs.size() <= this->capacity()
时不应分配新存储。operator+
可以在一些情况不分配新存储。The text was updated successfully, but these errors were encountered: