#include <iostream>
#include <vector>
#include <algorithm>
int main(int argc, const char* argv[])
{
std::vector<int> someVector{5, 0, 9, 0, 6, 0};
someVector.erase(std::remove_if(someVector.begin(),
someVector.end(),
[](int n){ return n == 0; }),
someVector.end());
for (const auto& entry : someVector)
{
std::cout << entry << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKaW50IG1haW4oaW50IGFyZ2MsIGNvbnN0IGNoYXIqIGFyZ3ZbXSkgCnsKCXN0ZDo6dmVjdG9yPGludD4gc29tZVZlY3Rvcns1LCAwLCA5LCAwLCA2LCAwfTsKCQoJc29tZVZlY3Rvci5lcmFzZShzdGQ6OnJlbW92ZV9pZihzb21lVmVjdG9yLmJlZ2luKCksIAoJCQkJCQkJICAgCQlzb21lVmVjdG9yLmVuZCgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCQlbXShpbnQgbil7IHJldHVybiBuID09IDA7IH0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCQlzb21lVmVjdG9yLmVuZCgpKTsKICAgIAogICAgCiAgICBmb3IgKGNvbnN0IGF1dG8mIGVudHJ5IDogc29tZVZlY3RvcikKICAgIHsKICAgIAlzdGQ6OmNvdXQgPDwgZW50cnkgPDwgc3RkOjplbmRsOwogICAgfQogICAgCiAgICByZXR1cm4gMDsKfQ==