Skip to content

Instantly share code, notes, and snippets.

@dmgerman
Created September 16, 2016 20:00
Show Gist options
  • Save dmgerman/30872ee99943388229685c3d13014d6a to your computer and use it in GitHub Desktop.
Save dmgerman/30872ee99943388229685c3d13014d6a to your computer and use it in GitHub Desktop.
#include <iostream>
#include <vector>
int main()
{
std::vector < // I want a vector
std::vector<double> // each element of the vector is a vector
> variableName // name of the vector
(5, // how many elements in the frist dimension
std::vector<double>(2) // It knows each element is a vector (the subvectors. Here we say exactly
// what size each subvector to create
);
std::cout << "Size first dimension : " << variableName.size() << std::endl;
std::cout << "Size second dimension : " << variableName[0].size() << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment