Skip to content

Commit

Permalink
Update ex14_30_StrBlob.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Jun 28, 2015
1 parent f80ac47 commit 2b68cf2
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions ch14/ex14_30_StrBlob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@

bool operator==(const StrBlob &lhs, const StrBlob &rhs)
{
return *lhs.data == *rhs.data;
return *lhs.data == *rhs.data;
}

bool operator!=(const StrBlob &lhs, const StrBlob &rhs)
{
return !(lhs == rhs);
return !(lhs == rhs);
}

bool operator< (const StrBlob &lhs, const StrBlob &rhs)
{
return std::lexicographical_compare(lhs.data->begin(), lhs.data->end(), rhs.data->begin(), rhs.data->end());
return std::lexicographical_compare(lhs.data->begin(), lhs.data->end(), rhs.data->begin(), rhs.data->end());
}

bool operator> (const StrBlob &lhs, const StrBlob &rhs)
{
return rhs < lhs;
return rhs < lhs;
}

bool operator<=(const StrBlob &lhs, const StrBlob &rhs)
{
return !(rhs < lhs);
return !(rhs < lhs);
}

bool operator>=(const StrBlob &lhs, const StrBlob &rhs)
{
return !(lhs < rhs);
return !(lhs < rhs);
}

//================================================================
Expand All @@ -45,32 +45,32 @@ bool operator>=(const StrBlob &lhs, const StrBlob &rhs)

bool operator==(const StrBlobPtr &lhs, const StrBlobPtr &rhs)
{
return lhs.curr == rhs.curr;
return lhs.curr == rhs.curr;
}

bool operator!=(const StrBlobPtr &lhs, const StrBlobPtr &rhs)
{
return !(lhs == rhs);
return !(lhs == rhs);
}

bool operator< (const StrBlobPtr &x, const StrBlobPtr &y)
{
return x.curr < y.curr;
return x.curr < y.curr;
}

bool operator> (const StrBlobPtr &x, const StrBlobPtr &y)
bool operator>(const StrBlobPtr &x, const StrBlobPtr &y)
{
return x.curr > y.curr;
return x.curr > y.curr;
}

bool operator<=(const StrBlobPtr &x, const StrBlobPtr &y)
{
return x.curr <= y.curr;
return x.curr <= y.curr;
}

bool operator>=(const StrBlobPtr &x, const StrBlobPtr &y)
{
return x.curr >= y.curr;
return x.curr >= y.curr;
}

//================================================================
Expand All @@ -81,32 +81,32 @@ bool operator>=(const StrBlobPtr &x, const StrBlobPtr &y)

bool operator==(const ConstStrBlobPtr &lhs, const ConstStrBlobPtr &rhs)
{
return lhs.curr == rhs.curr;
return lhs.curr == rhs.curr;
}

bool operator!=(const ConstStrBlobPtr &lhs, const ConstStrBlobPtr &rhs)
{
return !(lhs == rhs);
return !(lhs == rhs);
}

bool operator< (const ConstStrBlobPtr &lhs, const ConstStrBlobPtr &rhs)
{
return lhs.curr < rhs.curr;
return lhs.curr < rhs.curr;
}

bool operator> (const ConstStrBlobPtr &lhs, const ConstStrBlobPtr &rhs)
bool operator>(const ConstStrBlobPtr &lhs, const ConstStrBlobPtr &rhs)
{
return lhs.curr > rhs.curr;
return lhs.curr > rhs.curr;
}

bool operator<=(const ConstStrBlobPtr &lhs, const ConstStrBlobPtr &rhs)
{
return lhs.curr <= rhs.curr;
return lhs.curr <= rhs.curr;
}

bool operator>=(const ConstStrBlobPtr &lhs, const ConstStrBlobPtr &rhs)
{
return lhs.curr >= rhs.curr;
return lhs.curr >= rhs.curr;
}

//==================================================================
Expand All @@ -117,18 +117,18 @@ bool operator>=(const ConstStrBlobPtr &lhs, const ConstStrBlobPtr &rhs)

StrBlob& StrBlob::operator=(const StrBlob &lhs)
{
data = make_shared<vector<string>>(*lhs.data);
return *this;
data = make_shared<vector<string>>(*lhs.data);
return *this;
}

StrBlob& StrBlob::operator=(StrBlob &&rhs) NOEXCEPT
{
if (this != &rhs) {
data = std::move(rhs.data);
rhs.data = nullptr;
}
if (this != &rhs) {
data = std::move(rhs.data);
rhs.data = nullptr;
}

return *this;
return *this;
}

//==================================================================
Expand All @@ -139,12 +139,12 @@ StrBlob& StrBlob::operator=(StrBlob &&rhs) NOEXCEPT

StrBlobPtr StrBlob::begin()
{
return StrBlobPtr(*this);
return StrBlobPtr(*this);
}

StrBlobPtr StrBlob::end()
{
return StrBlobPtr(*this, data->size());
return StrBlobPtr(*this, data->size());
}

ConstStrBlobPtr StrBlob::cbegin() const
Expand Down

0 comments on commit 2b68cf2

Please sign in to comment.