Use copy_n instead of of copy

It is a better choice for this occasion and more performant.
This commit is contained in:
Rose 2022-09-23 10:04:57 -04:00
commit 86214400d9

View file

@ -22,10 +22,9 @@ namespace CalcEngine
Number::Number(PNUMBER p) noexcept Number::Number(PNUMBER p) noexcept
: m_sign{ p->sign } : m_sign{ p->sign }
, m_exp{ p->exp } , m_exp{ p->exp }
, m_mantissa{}
{ {
m_mantissa.reserve(p->cdigit); 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 PNUMBER Number::ToPNUMBER() const