diff options
Diffstat (limited to 'odb/lazy-ptr-impl.ixx')
-rw-r--r-- | odb/lazy-ptr-impl.ixx | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/odb/lazy-ptr-impl.ixx b/odb/lazy-ptr-impl.ixx index 72dc42e..985aa87 100644 --- a/odb/lazy-ptr-impl.ixx +++ b/odb/lazy-ptr-impl.ixx @@ -29,37 +29,28 @@ namespace odb { } - inline lazy_ptr_base& lazy_ptr_base:: - operator= (const lazy_ptr_base& r) + inline void lazy_ptr_base:: + reset_id () { - if (id_ != r.id_) - reset_ (r.db_, r.id_, r.free_, r.copy_); - else - db_ = r.db_; + if (id_) + free_ (id_); - return *this; + id_ = 0; } - inline lazy_ptr_base& lazy_ptr_base:: - operator= (const lazy_ptr_impl_ref& r) + inline void lazy_ptr_base:: + reset_ (database_type* db, const void* id, free_func free, copy_func copy) { - if (id_ != r.id_) - { - reset_id (); - id_ = r.id_; - free_ = r.free_; - copy_ = r.copy_; - } - - db_ = r.db_; - return *this; - } + void* idc (id ? copy (id) : 0); - inline lazy_ptr_base:: - ~lazy_ptr_base () - { if (id_) free_ (id_); + + free_ = free; + copy_ = copy; + + id_ = idc; + db_ = db; } inline void lazy_ptr_base:: @@ -76,28 +67,37 @@ namespace odb db_ = &db; } - inline void lazy_ptr_base:: - reset_id () + inline lazy_ptr_base& lazy_ptr_base:: + operator= (const lazy_ptr_base& r) { - if (id_) - free_ (id_); + if (id_ != r.id_) + reset_ (r.db_, r.id_, r.free_, r.copy_); + else + db_ = r.db_; - id_ = 0; + return *this; } - inline void lazy_ptr_base:: - reset_ (database_type* db, const void* id, free_func free, copy_func copy) + inline lazy_ptr_base& lazy_ptr_base:: + operator= (const lazy_ptr_impl_ref& r) { - void* idc (id ? copy (id) : 0); + if (id_ != r.id_) + { + reset_id (); + id_ = r.id_; + free_ = r.free_; + copy_ = r.copy_; + } + + db_ = r.db_; + return *this; + } + inline lazy_ptr_base:: + ~lazy_ptr_base () + { if (id_) free_ (id_); - - free_ = free; - copy_ = copy; - - id_ = idc; - db_ = db; } inline void lazy_ptr_base:: |