#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
struct X
{
X(int n) : n_(n) { }
X(const X& rhs) : n_(rhs.n_) { }
X& operator=(X&& rhs) { n_ = rhs.n_; std::cout << "=(X&&) "; }
int n_;
};
int main()
{
std::vector<X> v{2, 1, 8, 3, 4, 5, 6};
v.erase(std::remove_if(std::make_move_iterator(std::begin(v)),
std::make_move_iterator(std::end(v)),
[] (const X& x) { return x.n_ & 1; }).base(),
std::end(v));
for (auto& x : v)
std::cout << x.n_ << ' ';
std::cout << '\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8aXRlcmF0b3I+CgpzdHJ1Y3QgWAp7CiAgICBYKGludCBuKSA6IG5fKG4pIHsgfQogICAgWChjb25zdCBYJiByaHMpIDogbl8ocmhzLm5fKSB7IH0KCVgmIG9wZXJhdG9yPShYJiYgcmhzKSB7IG5fID0gcmhzLm5fOyBzdGQ6OmNvdXQgPDwgIj0oWCYmKSAiOyB9CiAgICBpbnQgbl87Cn07CgppbnQgbWFpbigpCnsKICAgIHN0ZDo6dmVjdG9yPFg+IHZ7MiwgMSwgOCwgMywgNCwgNSwgNn07CiAgICB2LmVyYXNlKHN0ZDo6cmVtb3ZlX2lmKHN0ZDo6bWFrZV9tb3ZlX2l0ZXJhdG9yKHN0ZDo6YmVnaW4odikpLAogICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfbW92ZV9pdGVyYXRvcihzdGQ6OmVuZCh2KSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgIFtdIChjb25zdCBYJiB4KSB7IHJldHVybiB4Lm5fICYgMTsgfSkuYmFzZSgpLAogICAgICAgICAgICBzdGQ6OmVuZCh2KSk7CiAgICBmb3IgKGF1dG8mIHggOiB2KQogICAgICAgIHN0ZDo6Y291dCA8PCB4Lm5fIDw8ICcgJzsKICAgIHN0ZDo6Y291dCA8PCAnXG4nOwp9