I do not understand what the 't' is that is created.
The definition of t
is:
const vector<int>& t
^^^^^ ^^^^^^ ^^^ ^
\ \ \ \______ Referencia
\ \ \_______________________________________ Enteros
\ \____________________________________ Vector
\_____________________________ Constante
t
is a constant reference to integer vector. It is defined within a for
range:
for (const vector<int>& t : flights)
^^^^^^^^^^^^^^^^^^^^ ^ ^^^^^^^
\ \ \___ flights (que es vector<vector<int>>)
\ \____ en
\____ Para cada t (en forma de const vector<int>&)
The for
of rank makes us an operation for each element of a container, in the previous case it will give a return for each t
(which is constant reference to vector of integers) in flights
(which is a vector vectors of integers).
Since flights
is a vector of integer vectors, each element of flights
will be an integer vector; we ask the loop% range co_de that traverses each element of for
without making copies (that's why we ask for reference ( flights
)) and without modifying the data (that's why we ask that it be constant ( &
)).
You could save a few clicks if you let the compiler write the data type for you:
for (const auto& t : flights)
^^^^^^^^^^^ ^ ^^^^^^^
\ \ \___ flights (que es vector<vector<int>>)
\ \____ en
\____ Para cada t (referencia constante a lo que toque)
And what it contains.
Each const
points (as a constant reference) to an element of t
, that being a vector of vectors of integers, each flights
will be an integer vector.