QVariant::Private: select storage in get at compile time

Change-Id: I82b0a7ec28400dac64ea785ba6766ca488e615aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Fabian Kosmale 2021-02-14 10:40:15 +01:00
parent 3f9d19b17b
commit 388e7504be

View File

@ -499,7 +499,7 @@ public:
// determine internal storage at compile time
template<typename T>
const T &get() const
{ return *static_cast<const T *>(storage()); }
{ return *static_cast<const T *>(CanUseInternalSpace<T> ? &data.data : data.shared->data()); }
template<typename T>
void set(const T &t)
{ *static_cast<T *>(CanUseInternalSpace<T> ? &data.data : data.shared->data()) = t; }