Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Discussion

A swap function typically looks like this, where U is some user-defined type:

class T { // ...
public:
 void swap( T& rhs ) {
  member1_.swap( rhs.member1_ );
  std::swap( member2_, rhs.member2_ );
 }

private:
 U member1_;
 int member2_;
};


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial