Skip to content

Commit

Permalink
Implement = operator for BigInteger
Browse files Browse the repository at this point in the history
There's a copy constructor, but no '=' operator implemented. This is dangerous.
  • Loading branch information
blackball committed Aug 7, 2015
1 parent fc50f10 commit c085447
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/rapidjson/internal/biginteger.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ class BigInteger {
if (length > 0)
AppendDecimal64(decimals + i, decimals + i + length);
}


BigInteger& operator=(const BigInteger &rhs)
{
count_ = rhs.count_;
std::memcpy(digits_, rhs.digits_, count_ * sizeof(Type));
return *this;
}

BigInteger& operator=(uint64_t u) {
digits_[0] = u;
count_ = 1;
Expand Down

0 comments on commit c085447

Please sign in to comment.