I’ve started using Position instances to keep track of positions in text, and I found some curious behavior (at least, to me).
Position::operator= isn’t safe for swapping, as it doesn’t actually assign whether the position is maintained. The target lvalue keeps its positionMaintained status before the assignment, and reapplies it after setting all other member vars. This also means that you can’t safely have a std::vector of Positions, or anything where operator= would be used for true copying.
My workaround is just to subclass it with my own operator=, but I’d like to hear your thoughts on this.