aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/boost/smart-ptr/lazy-ptr.hxx7
-rw-r--r--odb/boost/smart-ptr/lazy-ptr.ixx7
-rw-r--r--odb/boost/smart-ptr/lazy-ptr.txx27
3 files changed, 14 insertions, 27 deletions
diff --git a/odb/boost/smart-ptr/lazy-ptr.hxx b/odb/boost/smart-ptr/lazy-ptr.hxx
index 5050e16..ded4c74 100644
--- a/odb/boost/smart-ptr/lazy-ptr.hxx
+++ b/odb/boost/smart-ptr/lazy-ptr.hxx
@@ -136,6 +136,13 @@ namespace odb
template <class Y> friend class lazy_shared_ptr;
template <class Y> friend class lazy_weak_ptr;
+ // For lazy_weak_ptr::lock().
+ //
+ lazy_shared_ptr (const ::boost::shared_ptr<T>& p,
+ const lazy_ptr_impl<T>& i)
+ : p_ (p), i_ (i) {}
+
+ private:
mutable ::boost::shared_ptr<T> p_;
mutable lazy_ptr_impl<T> i_;
};
diff --git a/odb/boost/smart-ptr/lazy-ptr.ixx b/odb/boost/smart-ptr/lazy-ptr.ixx
index 3a6eae4..e3c423f 100644
--- a/odb/boost/smart-ptr/lazy-ptr.ixx
+++ b/odb/boost/smart-ptr/lazy-ptr.ixx
@@ -538,6 +538,13 @@ namespace odb
}
template <class T>
+ inline lazy_shared_ptr<T> lazy_weak_ptr<T>::
+ lock () const
+ {
+ return lazy_shared_ptr<T> (p_.lock (), i_);
+ }
+
+ template <class T>
inline ::boost::shared_ptr<T> lazy_weak_ptr<T>::
load () const
{
diff --git a/odb/boost/smart-ptr/lazy-ptr.txx b/odb/boost/smart-ptr/lazy-ptr.txx
index 9087bbb..8481bb5 100644
--- a/odb/boost/smart-ptr/lazy-ptr.txx
+++ b/odb/boost/smart-ptr/lazy-ptr.txx
@@ -40,32 +40,5 @@ namespace odb
return i_.database () == r.i_.database () &&
object_id<object_type1> () == r.template object_id<object_type2> ();
}
-
- //
- // lazy_weak_ptr
- //
-
- template <class T>
- lazy_shared_ptr<T> lazy_weak_ptr<T>::
- lock () const
- {
- ::boost::shared_ptr<T> sp (p_.lock ());
-
- if (sp)
- {
- if (database_type* db = i_.database ())
- return lazy_shared_ptr<T> (*db, sp);
- else
- return lazy_shared_ptr<T> (sp);
- }
- else
- {
- if (i_)
- return lazy_shared_ptr<T> (
- *i_.database (), i_.template object_id<T> ());
- else
- return lazy_shared_ptr<T> ();
- }
- }
}
}