aboutsummaryrefslogtreecommitdiff
path: root/odb/tr1-pointer-traits.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-12-09 10:36:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-12-09 10:36:15 +0200
commitec355c48c49074bebeb597f6e5dcedfeb9d52fae (patch)
tree9adb18bffe27c6d0bce53c7e6bad6be583dc59ee /odb/tr1-pointer-traits.hxx
parentd2b7cfe47694cef008949255426cc57ab9a8e18a (diff)
Add lazy pointer support
Built-in support is provided for raw, auto, and tr1 shared/weak pointers. New test: common/lazy-ptr.
Diffstat (limited to 'odb/tr1-pointer-traits.hxx')
-rw-r--r--odb/tr1-pointer-traits.hxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/odb/tr1-pointer-traits.hxx b/odb/tr1-pointer-traits.hxx
index c21d46a..bbeceab 100644
--- a/odb/tr1-pointer-traits.hxx
+++ b/odb/tr1-pointer-traits.hxx
@@ -24,6 +24,7 @@ namespace odb
{
public:
static pointer_kind const kind = pk_shared;
+ static bool const lazy = false;
typedef T element_type;
typedef std::tr1::shared_ptr<element_type> pointer_type;
@@ -45,7 +46,7 @@ namespace odb
static bool
null_ptr (const pointer_type& p)
{
- return p.get () == 0;
+ return !p;
}
public:
@@ -69,12 +70,17 @@ namespace odb
{
public:
static pointer_kind const kind = pk_weak;
+ static bool const lazy = false;
typedef T element_type;
typedef std::tr1::weak_ptr<element_type> pointer_type;
- typedef std::tr1::weak_ptr<const element_type> const_pointer_type;
typedef std::tr1::shared_ptr<element_type> strong_pointer_type;
- typedef std::tr1::shared_ptr<const element_type> strong_const_pointer_type;
+
+ static strong_pointer_type
+ lock (const pointer_type& p)
+ {
+ return p.lock ();
+ }
};
}