From 675dcc9c1131c1ca97938558cf82a4990d77663b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 29 Apr 2012 15:28:26 +0200 Subject: Rework unique pointer conversion (Clang warning) --- odb/no-op-cache-traits.hxx | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/odb/no-op-cache-traits.hxx b/odb/no-op-cache-traits.hxx index 84d1c7a..1d9db7c 100644 --- a/odb/no-op-cache-traits.hxx +++ b/odb/no-op-cache-traits.hxx @@ -47,21 +47,18 @@ namespace odb struct pointer_cache_type { // If the pointer is unique, then casting it can transfer ownership. - // So return null pointer, which will be ignored down the chain. + // In this case we return NULL void*, which will be ignored down the + // chain. // - typedef typename object_traits::pointer_type pointer_type; - - static pointer_type - convert (const P&) {return pointer_type ();} + static void* + convert (const P&) {return 0;} }; template struct pointer_cache_type { - typedef typename object_traits::pointer_type pointer_type; - - static pointer_type - convert (const P&) {return pointer_type ();} + static void* + convert (const P&) {return 0;} }; // reference_cache_type @@ -126,6 +123,11 @@ namespace odb static position_type insert (odb::database&, const pointer_type&) {return position_type ();} + // Special signature for unique pointers. + // + static position_type + insert (odb::database&, void*) {return position_type ();} + static pointer_type find (odb::database&, const id_type&) {return pointer_type ();} @@ -143,10 +145,12 @@ namespace odb struct position_type {}; static position_type - insert (odb::database&, const pointer_type&) - { - return position_type (); - } + insert (odb::database&, const pointer_type&) {return position_type ();} + + // Special signature for unique pointers. + // + static position_type + insert (odb::database&, void*) {return position_type ();} }; // reference_cache_traits @@ -183,10 +187,7 @@ namespace odb } static position_type - insert (odb::database&, object_type&) - { - return position_type (); - } + insert (odb::database&, object_type&) {return position_type ();} }; template @@ -196,10 +197,7 @@ namespace odb struct position_type {}; static position_type - insert (odb::database&, object_type&) - { - return position_type (); - } + insert (odb::database&, object_type&) {return position_type ();} }; } -- cgit v1.1