Make *ArrayOps::createInPlace protected

No user of QArrayDataPointer functionality must use createInPlace. This
is a special function to be called by the internal logic. It's usage is
unsafe with prepend optimization in place

Task-number: QTBUG-84320
Change-Id: Idc0e82975a98e799272bdb61fe7828b3c8c67e8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Andrei Golubev 2020-08-26 16:10:59 +02:00
parent 4a56a5f6cf
commit 15553c39f4

View File

@ -239,8 +239,12 @@ template <class T>
struct QPodArrayOps
: public QArrayDataPointer<T>
{
private:
protected:
typedef QTypedArrayData<T> Data;
template <typename ...Args>
void createInPlace(T *where, Args&&... args) { new (where) T(std::forward<Args>(args)...); }
public:
typedef typename QArrayDataPointer<T>::parameter_type parameter_type;
@ -344,8 +348,6 @@ public:
*where++ = t;
}
template <typename ...Args>
void createInPlace(T *where, Args&&... args) { new (where) T(std::forward<Args>(args)...); }
template <typename ...Args>
void emplace(T *where, Args&&... args)
@ -477,6 +479,13 @@ template <class T>
struct QGenericArrayOps
: public QArrayDataPointer<T>
{
protected:
typedef QTypedArrayData<T> Data;
template <typename ...Args>
void createInPlace(T *where, Args&&... args) { new (where) T(std::forward<Args>(args)...); }
public:
typedef typename QArrayDataPointer<T>::parameter_type parameter_type;
void appendInitialize(size_t newSize)
@ -728,8 +737,6 @@ struct QGenericArrayOps
}
}
template <typename ...Args>
void createInPlace(T *where, Args&&... args) { new (where) T(std::forward<Args>(args)...); }
template <typename iterator, typename ...Args>
void emplace(iterator where, Args&&... args)