aboutsummaryrefslogtreecommitdiff
path: root/odb/details/shared-ptr/base.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-08-14 09:37:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-25 06:39:57 +0200
commit8d4d2568f356cb9beb1553bf58ad69c1c800b996 (patch)
treed6466f2dec931669405b38a6cf47e8bb0998a4fd /odb/details/shared-ptr/base.txx
parent46f28dcdf5a72ed430486b562213ad147b65526a (diff)
Implement bulk database operation support for Oracle and SQL Server
Diffstat (limited to 'odb/details/shared-ptr/base.txx')
-rw-r--r--odb/details/shared-ptr/base.txx26
1 files changed, 10 insertions, 16 deletions
diff --git a/odb/details/shared-ptr/base.txx b/odb/details/shared-ptr/base.txx
index e00bd5c..7047b7a 100644
--- a/odb/details/shared-ptr/base.txx
+++ b/odb/details/shared-ptr/base.txx
@@ -13,38 +13,32 @@ namespace odb
{
// Support for locating the counter in the memory block.
//
+ struct LIBODB_EXPORT locator_common
+ {
+ static std::size_t*
+ counter (void*);
+ };
+
template <typename X, bool poly = meta::polymorphic_p<X>::result>
struct locator;
template <typename X>
- struct locator<X, false>
+ struct locator<X, false>: locator_common
{
static std::size_t*
counter (X* x)
{
- std::size_t* p (reinterpret_cast<std::size_t*> (x));
-
- if (*(--p) != 0xDEADBEEF)
- throw not_shared ();
-
- return --p;
+ return locator_common::counter (x);
}
};
template <typename X>
- struct locator<X, true>
+ struct locator<X, true>: locator_common
{
static std::size_t*
counter (X* x)
{
- std::size_t* p (
- static_cast<std::size_t*> (
- dynamic_cast<void*> (x)));
-
- if (*(--p) != 0xDEADBEEF)
- throw not_shared ();
-
- return --p;
+ return locator_common::counter (dynamic_cast<void*> (x));
}
};