Note that the name "assign_temporary" means that the assignment refers to an object that is temporary and therefore can be destroyed during the assignment process. The assignment operator accepts some regular object that you might want to use later, so it cannot destroy it during the assignment. In this code, Boost "assign_temporary" is synonymous with the rvalue reference assignment operator, and the assignment operator that you showed above is standard const (lvalue), so you expect this kind of mismatch between them.
I agree, however, the assignment operator is usually implemented using a copy and swap trick (create a copy using the copy constructor, and then replace it with the copy). However, the standard already defines the automatic implementation of the assignment operator by the compiler in the absence of an explicit definition, and therefore changing the default implementation can potentially violate existing code.
source share