If you may not to change the order of elements of the original vector then the straightforward approach is the following
std::vector<std::vector<int>> v;
int a[][2] = { { 0, 1 }, { 0, 3 }, { 0, 4 }, { 1, 0 }, { 1, 2 }, { 1, 5 }, { 3, 0 } };
std::transform( std::begin( a ), std::end( a ), std::back_inserter( v ),
[]( const int ( &row )[2] )
{
return std::vector<int>( std::begin( row ), std::end( row ) );
} );
for ( const std::vector<int> &row : v )
{
for ( int x : row ) std::cout << x << ' ';
std::cout << std::endl;
}
std::cout << std::endl;
std::function<bool( const std::vector<int> &, const std::vector<int> & )> identical =
[]( const std::vector<int> &v1, const std::vector<int> &v2 )
{
return ( v1.size() == v2.size() && v1.size() == 2 &&
( v1[0] == v2[0] && v1[1] == v2[1] || v1[0] == v2[1] && v1[1] == v2[0] ) );
};
auto last = v.begin();
for ( auto first = v.begin(); first != v.end(); ++first )
{
using namespace std::placeholders;
if ( std::find_if( v.begin(), last, std::bind( identical, _1, *first ) ) == last )
{
if ( first != last ) *last = *first;
++last;
}
}
v.erase( last, v.end() );
for ( const std::vector<int> &row : v )
{
for ( int x : row ) std::cout << x << ' ';
std::cout << std::endl;
}
Of course there was no any need to define intermediate array a that to initialize the vector. You can initialize it using initializer list.
The output is
0 1
0 3
0 4
1 0
1 2
1 5
3 0
0 1
0 3
0 4
1 2
1 5