Skip to content

Instantly share code, notes, and snippets.

@jackeylu
Created July 24, 2013 15:58
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 jackeylu/6071909 to your computer and use it in GitHub Desktop.
Save jackeylu/6071909 to your computer and use it in GitHub Desktop.
a basic to string method for different containers
#include <iostream>
#include <vector>
int main(void)
{
std::vector<int> vecInt(3);
vecInt[0] = 1;
vecInt[1] = 2;
vecInt[2] = 3;
//std::ostream ostr;
std::copy(vecInt.begin(), vecInt.end(), std::ostream_iterator<int>(std::cout,","));
//std::cout << ostr.str() << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment