Skip to content

Instantly share code, notes, and snippets.

@harrisony
Created October 12, 2012 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save harrisony/3877260 to your computer and use it in GitHub Desktop.
Save harrisony/3877260 to your computer and use it in GitHub Desktop.
Awesome hacky code!
void list_generator(int (*process)(Record, string[]), string options[], string success, string failure){
bool _recordcount = 0;
Record processing[recordcount];
for (int i=0; i <= recordcount; i++){
if ((*process)(records[i], options) > 0){
processing[++_recordcount] = records[i];
}
}
if (_recordcount > 0){
cout << success;
for (int i=0; i<= _recordcount; i++){
cout << processing[i].title << endl;
}
} else{
cout << failure;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment