vector<vector<X>> says to create a vector of vectors of X objects.
T(k+1, vector<X>(k+1)) says to call it T and make it an initial size of k+1 and to fill the k+1 elements of the outer vector with vector<X>'s that all have an initial size of k+1 with the X objects set to their default value (if it has one).
Foo val ( arguments ); // construct Foo object with name 'val'. Initialize with arguments
int n = 42; // construct int object with name 'n'. Initialize with value 42
vector<Foo> T ( n, val ); // construct vector of Foo objects with name 'T'
// the vector construction could be done hard way too:
vector<Foo> T; // empty vector
T.reserve( n ); // preallocate
for ( int i=0; i<n; ++i ) {
T.push_back( val );
}
// or
vector<Foo> T ( n ); // vector with n elements
for ( auto & e : T ) {
e = val; // copy
}
// or more directly, without n and val:
vector<Foo> T ( 42, Foo( arguments ) );
The Foo( arguments ) in the last version constructs an unnamed, temporary Foo object by calling Foo constructor that accepts arguments. The object is used as argument to call of vector's fill constructor.
In your case
1 2 3
Foo = vector<ll>
arguments = k+1
n = k+1
Your T is essentially a 2D array that has k+1 rows and k+1 columns.
#include <iostream>
#include <vector>
#include <string>
int main()
{
using ll = std::string;
using std::vector;
size_t k {7};
vector <vector <ll>>T(k+1,k+1);
}
In function 'int main()':
10:32: error: no matching function for call to 'std::vector<std::vector<std::basic_string<char> > >::vector(size_t, size_t)'
10:32: note: candidates are: ...