Skip to content

Instantly share code, notes, and snippets.

@aristidb
Created December 10, 2008 16:49
Show Gist options
  • Save aristidb/34375 to your computer and use it in GitHub Desktop.
Save aristidb/34375 to your computer and use it in GitHub Desktop.
boost::any environment::enumerate_start(int &n) {
n = 0; // We dont know how many
return boost::any(environ);
}
value environment::enumerate_next(boost::any &iter) {
char **env = boost::any_cast<char**>(iter);
if (*env == 0)
return value();
char *eq_c = strchr(*env, '=');
string result = string(*env, eq_c - *env);
iter = ++env;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment