From a28444da4ca6adb016f719e032174ccb54e1692e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 21 Sep 2011 13:00:33 +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/traits.hxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'odb/traits.hxx') 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::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 + struct view_traits + { + private: + typedef + odb::pointer_traits::pointer_type> + pointer_traits; + + public: + typedef typename access::view_traits::view_type view_type; + typedef typename pointer_traits::const_pointer_type const_pointer_type; + typedef const_pointer_type pointer_type; + }; + // // composite_value_traits // -- cgit v1.1