diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-09-21 13:00:33 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-09-21 13:00:33 +0200 |
commit | a28444da4ca6adb016f719e032174ccb54e1692e (patch) | |
tree | 75fe8ceae2d20baa3d4b5375a832598efe8b2fce /odb/tr1/pointer-traits.hxx | |
parent | 0046a34d5ad5fc1e88b33279605f179646b0ea59 (diff) |
Rework const object handling
Now objects are always loaded as non-const and the object cache in
session treats all objects as non-const.
Diffstat (limited to 'odb/tr1/pointer-traits.hxx')
-rw-r--r-- | odb/tr1/pointer-traits.hxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/odb/tr1/pointer-traits.hxx b/odb/tr1/pointer-traits.hxx index 80f6419..b6ef5ae 100644 --- a/odb/tr1/pointer-traits.hxx +++ b/odb/tr1/pointer-traits.hxx @@ -14,6 +14,7 @@ // #include <odb/pointer-traits.hxx> +#include <odb/details/meta/remove-const.hxx> namespace odb { @@ -29,6 +30,10 @@ namespace odb typedef T element_type; typedef std::tr1::shared_ptr<element_type> pointer_type; typedef std::tr1::shared_ptr<const element_type> const_pointer_type; + typedef typename details::meta::remove_const<element_type>::result + unrestricted_element_type; + typedef std::tr1::shared_ptr<unrestricted_element_type> + unrestricted_pointer_type; typedef smart_ptr_guard<pointer_type> guard; static element_type* @@ -49,6 +54,12 @@ namespace odb return !p; } + static unrestricted_pointer_type + cast (const pointer_type& p) + { + return std::tr1::const_pointer_cast<unrestricted_element_type> (p); + } + public: static void* allocate (std::size_t n) |