|
Besides that, a destructor needs to be called for the temporary variable as well. The std::string has its own swap() method indeed. It is usually between 6 or 7 times as faster as the methods presented earlier.
Nevertheless, there is no "irony" involved in the kind of assignments presented earlier. Often the student needs to learn to develop algorithms at an early stage. Re-inventing the wheel is a common thing.
__________________
|