dimanche 30 mai 2021

Is it possible to swap std::array in constant time?

From what I understand, swapping a std::vector is a constant time operation because the only pointers are being swapped, but in the case of an std::array the swapping is element-wise. Is it possible to swap the pointers of an std::array?

Apologies if this has been asked to death already. If so kindly point me in the right direction, thanks.

Aucun commentaire:

Enregistrer un commentaire