Skip to content

Instantly share code, notes, and snippets.

@superwills
Created January 16, 2015 03:12
Show Gist options
  • Save superwills/f1f0bf04e695f94cd595 to your computer and use it in GitHub Desktop.
Save superwills/f1f0bf04e695f94cd595 to your computer and use it in GitHub Desktop.
2D matrix
// For allocating a 2D vector
template <typename T> vector< vector<T> > twoD( size_t rows, size_t cols )
{
vector< vector<T> > vv( rows );
for( int i = 0; i < vv.size(); i++ )
vv[i].resize( cols );
return vv;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment