Skip to content

Instantly share code, notes, and snippets.

@roxlu
Created July 15, 2011 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roxlu/1084487 to your computer and use it in GitHub Desktop.
Save roxlu/1084487 to your computer and use it in GitHub Desktop.
Remove particles using ofRemove
class Particle {
public:
Particle() {
alive = (int)ofRandom(0,5);
}
bool operator()(const Particle& p) {
return p.alive;
}
int alive;
};
//-----------------
// create some particles.
for(int i = 0; i < 10; ++i) {
Particle p;
parts.push_back(p);
}
ofRemove(parts, Particle::Particle());
cout << "We have:" << parts.size() << " particles." << endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment