#include <iostream>     // cout
#include <algorithm> // copy_if, distance
#include <vector> // vector
using namespace std;
int main () {
vector<int> foo = {,,,-,-};
vector<int> bar (foo.size()); // copy only positive numbers:
auto it = copy_if (foo.begin(), foo.end(), bar.begin(), [](int i){return !(i<);} );
bar.resize(distance(bar.begin(),it)); // shrink container to new size cout << "bar contains:";
for (int& x: bar) cout << ' ' << x;
cout << '\n'; return ;
}
05-15 08:25