diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-11-19 14:21:10 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-07-06 21:30:06 +0200 |
commit | a46caf087ca70a7482e065defa4d9547ae1335bd (patch) | |
tree | 4d112d89cdf9d57f5749ff0cbc638551f70d0caa /src/corelib/tools/qarraydata.h | |
parent | 76004502baa118016c8e0f32895af7a822f1ba37 (diff) | |
download | qtbase-a46caf087ca70a7482e065defa4d9547ae1335bd.tar.gz |
Simplify Q_ARRAY_LITERAL
And clean up some unused pieces of code.
Change-Id: I285b6862dc67b7130af66d3e08f652b1a56b990e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r-- | src/corelib/tools/qarraydata.h | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index d0a285a0e9..c921e4eaa5 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -165,23 +165,6 @@ struct Q_CORE_EXPORT QArrayData Q_DECLARE_OPERATORS_FOR_FLAGS(QArrayData::ArrayOptions) -template <class T, size_t N> -struct QStaticArrayData -{ - // static arrays are of type RawDataType - QArrayData header; - T data[N]; -}; - -// Support for returning QArrayDataPointer<T> from functions -template <class T> -struct QArrayDataPointerRef -{ - QTypedArrayData<T> *ptr; - T *data; - uint size; -}; - template <class T> struct QTypedArrayData : QArrayData @@ -218,34 +201,8 @@ struct QTypedArrayData static_assert(sizeof(QTypedArrayData) == sizeof(QArrayData)); QArrayData::deallocate(data, sizeof(T), alignof(AlignmentDummy)); } - - static QArrayDataPointerRef<T> fromRawData(const T *data, size_t n) - { - static_assert(sizeof(QTypedArrayData) == sizeof(QArrayData)); - QArrayDataPointerRef<T> result = { - nullptr, const_cast<T *>(data), uint(n) - }; - return result; - } }; -//////////////////////////////////////////////////////////////////////////////// -// Q_ARRAY_LITERAL - -// The idea here is to place a (read-only) copy of header and array data in an -// mmappable portion of the executable (typically, .rodata section). This is -// accomplished by hiding a static const instance of QStaticArrayData, which is -// POD. - -// Hide array inside a lambda -#define Q_ARRAY_LITERAL(Type, ...) \ - ([]() -> QArrayDataPointerRef<Type> { \ - static Type const data[] = { __VA_ARGS__ }; \ - enum { Size = sizeof(data) / sizeof(data[0]) }; \ - return { nullptr, const_cast<Type *>(data), Size }; \ - }()) - /**/ - namespace QtPrivate { struct Q_CORE_EXPORT QContainerImplHelper { |