8#include <QtCore/qarraydata.h>
9#include <QtCore/qcontainertools_impl.h>
29 static_assert (std::is_nothrow_destructible_v<T>,
"Types with throwing destructors are not supported in Qt containers.");
47 T *where = this->
end();
49 const T *
e = this->
end();
64 ::memcpy(
static_cast<void *
>(this->
end()),
static_cast<const void *
>(
b), (
e -
b) *
sizeof(T));
75 T *where = this->
end();
109 T *insertionPoint = this->
ptr + where;
111 if (where < this->
size)
112 ::memmove(
static_cast<void *
>(insertionPoint +
n),
static_cast<void *
>(insertionPoint), (this->size - where) *
sizeof(T));
119 return insertionPoint;
125 if (this->
size != 0 &&
i == 0)
134 ::memcpy(
static_cast<void *
>(where),
static_cast<const void *
>(
data),
n *
sizeof(T));
142 if (this->
size != 0 &&
i == 0)
154 template<
typename... Args>
160 new (this->
end()) T(std::forward<Args>(
args)...);
165 new (this->
begin() - 1) T(std::forward<Args>(
args)...);
171 T tmp(std::forward<Args>(
args)...);
173 if (this->
size != 0 &&
i == 0)
179 new (where) T(std::move(tmp));
194 if (
b == this->
begin() && e != this->
end()) {
196 }
else if (e != this->
end()) {
197 ::memmove(
static_cast<void *
>(
b),
static_cast<void *
>(
e),
198 (
static_cast<T *
>(this->
end()) - e) *
sizeof(T));
218 template <
typename Predicate>
227 auto it = std::remove_if(this->
begin(),
end, pred);
234 const auto end = this->
end();
241 auto dest =
other.begin();
243 dest = std::uninitialized_copy(
begin,
it, dest);
245 other.size = std::distance(
other.data(), dest);
257 std::for_each(ranges.begin(), ranges.end(), [&
it](
const auto &
span) {
258 it = std::copy(span.begin, span.end, it);
269 ::memcpy(
static_cast<void *
>(
b++),
static_cast<const void *
>(&
t),
sizeof(T));
272 bool compare(
const T *begin1,
const T *begin2,
size_t n)
const
278 return ::memcmp(begin1, begin2,
n *
sizeof(T)) == 0;
280 const T *end1 = begin1 +
n;
281 while (begin1 != end1) {
282 if (*begin1 == *begin2) {
298 this->
d = pair.first;
299 this->
ptr = pair.second;
307 static_assert (std::is_nothrow_destructible_v<T>,
"Types with throwing destructors are not supported in Qt containers.");
323 T *
const b = this->
begin();
325 new (b + this->
size) T;
326 }
while (++this->
size != newSize);
373 new (
data + this->
size) T(std::move(*
b));
385 std::destroy(this->
begin() + newSize, this->
end());
386 this->
size = newSize;
397 std::destroy(this->
begin(), this->
end());
509 new (
end) T(std::move(
t));
514 new (
end) T(std::move(*(
end - 1)));
529 const bool growsAtBegin = this->
size != 0 &&
i == 0;
555 const bool growsAtBegin = this->
size != 0 &&
i == 0;
575 template<
typename... Args>
581 new (this->
end()) T(std::forward<Args>(
args)...);
586 new (this->
begin() - 1) T(std::forward<Args>(
args)...);
592 T tmp(std::forward<Args>(
args)...);
593 const bool growsAtBegin = this->
size != 0 &&
i == 0;
600 new (this->
begin() - 1) T(std::move(tmp));
620 if (
b == this->
begin() && e != this->
end()) {
623 const T *
const end = this->
end();
650 (this->
end() - 1)->~T();
664 bool compare(
const T *begin1,
const T *begin2,
size_t n)
const
666 const T *end1 = begin1 +
n;
667 while (begin1 != end1) {
668 if (*begin1 == *begin2) {
683 static_assert (std::is_nothrow_destructible_v<T>,
"Types with throwing destructors are not supported in Qt containers.");
706 if constexpr (!std::is_nothrow_copy_constructible_v<T>) {
719 T *insertionPoint =
data->ptr +
pos;
725 return insertionPoint;
754 new (where) T(std::move(
t));
764 const bool growsAtBegin = this->
size != 0 &&
i == 0;
790 const bool growsAtBegin = this->
size != 0 &&
i == 0;
810 template<
typename... Args>
816 new (this->
end()) T(std::forward<Args>(
args)...);
821 new (this->
begin() - 1) T(std::forward<Args>(
args)...);
827 T tmp(std::forward<Args>(
args)...);
828 const bool growsAtBegin = this->
size != 0 &&
i == 0;
834 new (this->
begin() - 1) T(std::move(tmp));
857 if (
b == this->
begin() && e != this->
end()) {
859 }
else if (e != this->
end()) {
860 memmove(
static_cast<void *
>(
b),
static_cast<const void *
>(
e), (
static_cast<const T *
>(this->
end()) - e)*
sizeof(T));
870 this->
d = pair.first;
871 this->
ptr = pair.second;
875template <
class T,
class =
void>
883 typename
std::enable_if<
884 !QTypeInfo<T>::isComplex && QTypeInfo<T>::isRelocatable
892 typename
std::enable_if<
893 QTypeInfo<T>::isComplex && QTypeInfo<T>::isRelocatable
916 template<
typename It>
925#if __cplusplus >= 202002L && defined(__cpp_concepts) && defined(__cpp_lib_concepts)
926 constexpr bool canUseCopyAppend =
927 std::contiguous_iterator<It> &&
929 std::remove_cv_t<typename std::iterator_traits<It>::value_type>,
932 if constexpr (canUseCopyAppend) {
933 this->
copyAppend(std::to_address(
b), std::to_address(
e));
938 for (; b !=
e; ++
iter, ++
b) {
T loadRelaxed() const noexcept
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static constexpr bool q_points_into_range(const T *p, const T *b, const T *e, Cmp less={}) noexcept
T * q_uninitialized_remove_copy_if(T *first, T *last, T *out, Predicate &pred)
typename std::enable_if< std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::forward_iterator_tag >::value, bool >::type IfIsForwardIterator
static jboolean copy(JNIEnv *, jobject)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei GLsizei GLfloat distance
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei GLsizei GLchar * source
GLenum GLenum GLsizei void GLsizei void void * span
Q_CHECK_PTR(a=new int[80])
std::uniform_real_distribution dist(1, 2.5)
[2]
void detachAndGrow(QArrayData::GrowthPosition where, qsizetype n, const T **data, QArrayDataPointer *old)
bool isShared() const noexcept
qsizetype freeSpaceAtBegin() const noexcept
void detach(QArrayDataPointer *old=nullptr)
bool needsDetach() const noexcept
qsizetype allocatedCapacity() noexcept
std::conditional< pass_parameter_by_value, T, constT & >::type parameter_type
Q_NODISCARD_CTOR constexpr QArrayDataPointer() noexcept
qsizetype freeSpaceAtEnd() const noexcept
void swap(QArrayDataPointer &other) noexcept
bool isMutable() const noexcept
static QPair< QTypedArrayData *, T * > reallocateUnaligned(QTypedArrayData *data, T *dataPointer, qsizetype capacity, AllocationOption option)
static QPair< QTypedArrayData *, T * > allocate(qsizetype capacity, AllocationOption option=QArrayData::KeepSize)
QMovableArrayOps< T > Type
QGenericArrayOps< T > Type
typename QArrayOpsSelector< T >::Type Base
void appendIteratorRange(It b, It e, QtPrivate::IfIsForwardIterator< It >=true)
void growAppend(const T *b, const T *e)
typename Base::parameter_type parameter_type
void insert(qsizetype pos, const T &t, qsizetype n)
Inserter(QArrayDataPointer< T > *d)
void insertOne(qsizetype pos, T &&t)
qsizetype sourceCopyConstruct
QArrayDataPointer< T > * data
void setup(qsizetype pos, qsizetype n)
void insert(qsizetype pos, const T *source, qsizetype n)
qsizetype sourceCopyAssign
void truncate(size_t newSize)
void appendInitialize(qsizetype newSize)
void insert(qsizetype i, qsizetype n, parameter_type t)
QArrayDataPointer< T >::parameter_type parameter_type
void moveAppend(T *b, T *e)
QTypedArrayData< T > Data
void emplace(qsizetype i, Args &&... args)
void copyAppend(const T *b, const T *e)
void eraseFirst() noexcept
void eraseLast() noexcept
void assign(T *b, T *e, parameter_type t)
void erase(T *b, qsizetype n)
bool compare(const T *begin1, const T *begin2, size_t n) const
void insert(qsizetype i, const T *data, qsizetype n)
void copyAppend(qsizetype n, parameter_type t)
void insertOne(qsizetype pos, T &&t)
void insert(qsizetype pos, const T &t, qsizetype n)
T * displace(qsizetype pos, qsizetype n)
void insert(qsizetype pos, const T *source, qsizetype n)
Inserter(QArrayDataPointer< T > *d)
QArrayDataPointer< T > * data
QTypedArrayData< T > Data
void reallocate(qsizetype alloc, QArrayData::AllocationOption option)
void insert(qsizetype i, const T *data, qsizetype n)
void emplace(qsizetype i, Args &&... args)
QGenericArrayOps< T >::parameter_type parameter_type
void erase(T *b, qsizetype n)
void insert(qsizetype i, qsizetype n, parameter_type t)
void moveAppend(T *b, T *e) noexcept
void eraseFirst() noexcept
void appendInitialize(qsizetype newSize) noexcept
QArrayDataPointer< T >::parameter_type parameter_type
void copyRanges(std::initializer_list< Span > ranges)
void erase(T *b, qsizetype n)
void eraseLast() noexcept
T * createHole(QArrayData::GrowthPosition pos, qsizetype where, qsizetype n)
void insert(qsizetype i, const T *data, qsizetype n)
void truncate(size_t newSize) noexcept
void emplace(qsizetype i, Args &&... args)
qsizetype eraseIf(Predicate pred)
void assign(T *b, T *e, parameter_type t) noexcept
void copyAppend(const T *b, const T *e) noexcept
void copyAppend(qsizetype n, parameter_type t) noexcept
bool compare(const T *begin1, const T *begin2, size_t n) const
void reallocate(qsizetype alloc, QArrayData::AllocationOption option)
void insert(qsizetype i, qsizetype n, parameter_type t)
QTypedArrayData< T > Data
void destroyAll() noexcept