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/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/traits.hxx')
-rw-r--r-- | odb/traits.hxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/odb/traits.hxx b/odb/traits.hxx index 3f400cb..4d136af 100644 --- a/odb/traits.hxx +++ b/odb/traits.hxx @@ -194,6 +194,26 @@ namespace odb typedef typename access::view_traits<T>::pointer_type pointer_type; }; + // Specialization for const views. It only defines the view, pointer, + // and const_pointer types with pointer and const_pointer being the + // same. Similar to objects, the idea is to only use this specialization + // in the interfaces, with the implementations detecting this situation + // and using the non-const view_traits version. + // + template <typename T> + struct view_traits<const T> + { + private: + typedef + odb::pointer_traits<typename access::view_traits<T>::pointer_type> + pointer_traits; + + public: + typedef typename access::view_traits<T>::view_type view_type; + typedef typename pointer_traits::const_pointer_type const_pointer_type; + typedef const_pointer_type pointer_type; + }; + // // composite_value_traits // |