Skip to content

Instantly share code, notes, and snippets.

@wildskyf
Last active December 4, 2015 08:47
Show Gist options
  • Save wildskyf/0664a4793b6637ae141b to your computer and use it in GitHub Desktop.
Save wildskyf/0664a4793b6637ae141b to your computer and use it in GitHub Desktop.
This is tmp code
void String::swap(String & rhs)
{
char * tmp_str = str_;
int tmp_size = size_,
tmp_cap = capacity_ ;
str_ = rhs.str_;
size_ = rhs.size_;
capacity_ = rhs.capacity_;
rhs.str_ = tmp_str;
rhs.size_ = tmp_size;
rhs.capacity_ = tmp_cap;
}
void swap(String & lhs, String & rhs)
{
lhs.swap(rhs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment