optimad / bitpit

Open source library for scientific HPC
http://optimad.github.io/bitpit/
GNU Lesser General Public License v3.0
117 stars 33 forks source link

containers: fix swap for PiercedStorage<bool> #318

Closed andrea-iob closed 2 years ago

andrea-iob commented 2 years ago

The [] operator of std::vector returns a temporary object of a proxy type called std::vector::reference, rather than an actual bool&.

Although the libstdc++ defines an overload for swapping this type of proxy objects, this is just an extension to the standard.

Without this change bitpit doesn't compile with gcc 12.

andrea-iob commented 2 years ago

I've added a comment.