From cd09ab74e179fd4c42ad226fd5cc609485a8df01 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 22 Nov 2010 12:01:11 +0200 Subject: Add pointer kind and const_pointer to pointer traits --- odb/pointer-traits.hxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'odb/pointer-traits.hxx') diff --git a/odb/pointer-traits.hxx b/odb/pointer-traits.hxx index 34ec7cd..cd25820 100644 --- a/odb/pointer-traits.hxx +++ b/odb/pointer-traits.hxx @@ -14,6 +14,14 @@ namespace odb { + enum pointer_kind + { + pk_naked, // Naked or equivalent (i.e., unmanaged). + pk_unique, // Smart pointer that doesn't support sharing. + pk_shared, // Smart pointer that support sharing. + pk_weak // Weak counterpart for shared pointer. + }; + template class pointer_traits; @@ -67,8 +75,11 @@ namespace odb class pointer_traits { public: + static pointer_kind const kind = pk_naked; + typedef T element_type; typedef T* pointer_type; + typedef const T* const_pointer_type; typedef naked_ptr_guard guard_type; // Return naked pointer to the pointed-to element, including NULL. @@ -124,8 +135,11 @@ namespace odb class pointer_traits< std::auto_ptr > { public: + static pointer_kind const kind = pk_unique; + typedef T element_type; typedef std::auto_ptr pointer_type; + typedef std::auto_ptr const_pointer_type; typedef smart_ptr_guard guard_type; static element_type* -- cgit v1.1