Skip to content

Instantly share code, notes, and snippets.

@Kraks
Last active December 15, 2015 21:29
Show Gist options
  • Select an option

  • Save Kraks/5325817 to your computer and use it in GitHub Desktop.

Select an option

Save Kraks/5325817 to your computer and use it in GitHub Desktop.
/* convert argv into a list
*/
#include <iostream>
#include <string>
#include <list>
#include <vector>
using namespace std;
int main(int argc, char **argv)
{
list<string> argv_list(argv, argv+argc);
for (list<string>::iterator it = argv_list.begin(); it != argv_list.end(); it++)
cout << *it << " ";
vector<string> v(argv, argv+argc);
for (vector<string>::iterator it = v.begin(); it != v.end(); it++)
cout << *it << " ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment