From 5e8129bc2924abd1bfefb21598100bc519159fb6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 21 Sep 2011 13:00:34 +0200 Subject: Rework const object handling Now objects are always loaded as non-const and the object cache in session treats all objects as non-const. --- odb/qt/smart-ptr/pointer-traits.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'odb/qt/smart-ptr') diff --git a/odb/qt/smart-ptr/pointer-traits.hxx b/odb/qt/smart-ptr/pointer-traits.hxx index 8a981ba..7c26a4b 100644 --- a/odb/qt/smart-ptr/pointer-traits.hxx +++ b/odb/qt/smart-ptr/pointer-traits.hxx @@ -12,6 +12,7 @@ #include #include +#include namespace odb { @@ -27,6 +28,10 @@ namespace odb typedef T element_type; typedef QSharedPointer pointer_type; typedef QSharedPointer const_pointer_type; + typedef typename details::meta::remove_const::result + unrestricted_element_type; + typedef QSharedPointer + unrestricted_pointer_type; typedef smart_ptr_guard guard; static element_type* @@ -47,6 +52,12 @@ namespace odb return !p; } + static unrestricted_pointer_type + cast (const pointer_type& p) + { + return qSharedPointerConstCast (p); + } + public: static void* allocate (std::size_t n) -- cgit v1.1