1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-08 08:01:19 +02:00

Define ArrayOf<T>::reinit

This commit is contained in:
Paul Licameli 2016-04-02 13:02:33 -04:00
parent d0d1a7fcb5
commit 2d57549f0c

View File

@ -364,10 +364,7 @@ public:
ArrayOf() {}
explicit ArrayOf(size_t count, bool initialize = false)
{
if (initialize)
this->reset(safenew X[count]{});
else
this->reset(safenew X[count]);
reinit(count, initialize);
}
ArrayOf(const ArrayOf&) = delete;
ArrayOf& operator= (ArrayOf &&that)
@ -380,6 +377,14 @@ public:
std::unique_ptr<X[]>::operator=(std::move(that));
return *this;
}
void reinit(size_t count, bool initialize = false)
{
if (initialize)
std::unique_ptr<X[]>::reset(safenew X[count]{});
else
std::unique_ptr<X[]>::reset(safenew X[count]);
}
};
/*