mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 15:43:58 +00:00
Update c++.html.markdown
v.empty() queries if v is empty while v.clear() actually clears it (or rather sets size to 0).
This commit is contained in:
parent
e1016455d5
commit
1bb2535efd
@ -948,7 +948,7 @@ for (int i = 0; i < 10; ++i)
|
||||
|
||||
// Following line sets size of v to 0, but destructors don't get called
|
||||
// and resources aren't released!
|
||||
v.empty();
|
||||
v.clear();
|
||||
v.push_back(Foo()); // New value is copied into the first Foo we inserted
|
||||
|
||||
// Truly destroys all values in v. See section about temporary objects for
|
||||
|
Loading…
Reference in New Issue
Block a user