Use copy_n instead of of copy (#1897)

It is a better choice for this occasion and more performant.
This commit is contained in:
Rose 2022-09-23 14:59:28 -04:00 committed by GitHub
commit 095a81fecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,10 +22,9 @@ namespace CalcEngine
Number::Number(PNUMBER p) noexcept
: m_sign{ p->sign }
, m_exp{ p->exp }
, m_mantissa{}
{
m_mantissa.reserve(p->cdigit);
copy(p->mant, p->mant + p->cdigit, back_inserter(m_mantissa));
copy_n(p->mant, p->cdigit, back_inserter(m_mantissa));
}
PNUMBER Number::ToPNUMBER() const