lundi 30 novembre 2020

2d vectors c++ swapping rows/columns

Just out curiosity, is it possible to swap rows/columns of a 2d vector with the STL swap_ranges function, like:

void swooop(std::vector<std::vector<int>>& ar2d) {
    swap_ranges(ar2d.begin()->begin(), ar2d.begin()->end(), (ar2d.end()-1)->begin());
}

Aucun commentaire:

Enregistrer un commentaire