To delete a "row" in a vector of vectors is easy.
For example
#include <vector>
#include <iterator>
//...
matrix.erase( std::next( std::begin( matrix ) ) );
Here is a demonstration program
#include <iostream>
#include <vector>
#include <iterator>
int main()
{
std::vector<std::vector<int>> matrix =
{
{ 1, 3 }, { 2, 6 }, { 8, 10 }, { 15, 18 }
};
for (const auto &row : matrix)
{
bool first = true;
std::cout << '[';
for (const auto &item : row)
{
if (!first)
{
std::cout << ", ";
}
else
{
first = false;
}
std::cout << item;
}
std::cout << "]\n";
}
std::cout << '\n';
matrix.erase( std::next( std::begin( matrix ) ) );
for (const auto &row : matrix)
{
bool first = true;
std::cout << '[';
for (const auto &item : row)
{
if (!first)
{
std::cout << ", ";
}
else
{
first = false;
}
std::cout << item;
}
std::cout << "]\n";
}
std::cout << '\n';
}
The program output is
[1, 3]
[2, 6]
[8, 10]
[15, 18]
[1, 3]
[8, 10]
[15, 18]
To remove the i-th "row" you can use the expression std::next( std::begin( matrix ), i )
shown in the statement below
matrix.erase( std::next( std::begin( matrix ), i ) );