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
mystl::vector<int> vector(10); mystl::vector<int> v(1); *(int*)(v.begin() + 10) = 200; v = vector; std::cout << "v.capaty:" << v.capacity() << " v.size:" << v.size() << " "<< * (int*)(v.begin() + 10);//v的初始容量为16,但是经过赋值构造后,cap_指向了第10个元素的后面,导致后面6个元素内存没有被释放,内存泄露
The text was updated successfully, but these errors were encountered:
*(int*)(v.begin() + 10) = 200; 这行怎么看都是错的。
*(int*)(v.begin() + 10) = 200;
最好先提供一个正确的代码。
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: