aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-29 15:28:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-29 15:28:26 +0200
commit675dcc9c1131c1ca97938558cf82a4990d77663b (patch)
tree3c2e41d8cbe20bb285cf8f3735a8ec2ad8f64014
parent900e5844abcab2cbd131f8595e3f0b2706625964 (diff)
Rework unique pointer conversion (Clang warning)
-rw-r--r--odb/no-op-cache-traits.hxx40
1 files 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<P, E, O, pk_unique>
{
// 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<O>::pointer_type pointer_type;
-
- static pointer_type
- convert (const P&) {return pointer_type ();}
+ static void*
+ convert (const P&) {return 0;}
};
template <typename P, typename T>
struct pointer_cache_type<P, T, T, pk_unique>
{
- typedef typename object_traits<T>::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 <typename T>
@@ -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 ();}
};
}