summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-07-02 13:44:17 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-07-02 13:44:17 (GMT)
commit501d1395bd3fc6c67e50216345959d31c0db7707 (patch)
tree0fcbc61cf5251f8e70bb4ed86391e184b32f9dde /src/corelib
parentd70839d4fd855d6d5f6bf8d982b677402f71e5ba (diff)
downloadQt-501d1395bd3fc6c67e50216345959d31c0db7707.zip
Qt-501d1395bd3fc6c67e50216345959d31c0db7707.tar.gz
Qt-501d1395bd3fc6c67e50216345959d31c0db7707.tar.bz2
Revert "Add support for creating the object alongside the Data structure in QSharedPointer"
This reverts commit fb51a10ee0451274a430227566ae26efb2ac4474. Sorry, it didn't work. I can fix the MSVC error, but the problem is that older GCC versions (4.2) fail with the following code: template<typename T> struct Buffer { char buffer[128] __attribute__((aligned(__alignof__(T)))); }; The same works fine in GCC 4.4.
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 2fa9eb2..739a949 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -48,7 +48,6 @@
#pragma qt_sync_stop_processing
#endif
-#include <new>
#include <QtCore/qatomic.h>
#include <QtCore/qobject.h> // for qobject_cast
@@ -191,34 +190,6 @@ namespace QtSharedPointer {
};
template <class T>
- struct ExternalRefCountWithContiguousData: public ExternalRefCountData
- {
-#ifdef Q_DECL_ALIGN
-# ifdef Q_ALIGNOF
-# define QSP_ALIGNOF(T) Q_ALIGNOF(T)
-# else
-# define QSP_ALIGNOF(T) (sizeof(T) >= 16 ? 16 : sizeof(T) >= 8 ? 8 : sizeof(T) >= 4 ? 4 : sizeof(T) >= 2 ? 2 : 1)
-# endif
-
- char data[sizeof(T)] Q_DECL_ALIGN(QSP_ALIGNOF(T));
- inline T *pointer() { return reinterpret_cast<T *>(data); }
-
-# undef QSP_ALIGNOF
-#else
- union {
- char data[sizeof(T) + 16];
- double dummy1;
-# ifndef Q_OS_DARWIN
- long double dummy2;
-# endif
- };
- inline T *pointer() { return reinterpret_cast<T *>(data + 16 - (quintptr(data) & 0xf)); }
-#endif
-
- inline bool destroy() { this->pointer()->~T(); return true; }
- };
-
- template <class T>
class ExternalRefCount: public Basic<T>
{
typedef ExternalRefCountData Data;
@@ -249,16 +220,6 @@ namespace QtSharedPointer {
d = new ExternalRefCountWithSpecializedDeleter<T, Deleter>(ptr, deleter);
}
- inline void internalCreate()
- {
- ExternalRefCountWithContiguousData<T> *dd = new ExternalRefCountWithContiguousData<T>;
- T *ptr = dd->pointer();
- new (ptr) T(); // create
-
- Basic<T>::internalConstruct(ptr);
- d = dd;
- }
-
inline ExternalRefCount() : d(0) { }
inline ~ExternalRefCount() { if (d && !deref()) delete d; }
inline ExternalRefCount(const ExternalRefCount<T> &other) : Basic<T>(other), d(other.d)
@@ -386,14 +347,6 @@ public:
inline void clear() { *this = QSharedPointer<T>(); }
QWeakPointer<T> toWeakRef() const;
-
-public:
- static QSharedPointer<T> create()
- {
- QSharedPointer<T> result;
- result.internalCreate();
- return result;
- }
};
template <class T>