aboutsummaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-02-12 19:19:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-02-12 19:19:44 +0200
commitbc156ed2b2d0c31614a79af05156f02135f4fda7 (patch)
tree49bf88a034d846b531337733fc9dca8f2714369d /odb
parenta6a846ad051043cb389b401035f361864a691ec6 (diff)
Don't use uninitialized iterator on the rhs of assignment2.2.0
Diffstat (limited to 'odb')
-rw-r--r--odb/session.hxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/odb/session.hxx b/odb/session.hxx
index 5556211..3ceeb8d 100644
--- a/odb/session.hxx
+++ b/odb/session.hxx
@@ -146,6 +146,17 @@ namespace odb
cache_position (): map_ (0) {}
cache_position (map& m, const iterator& p): map_ (&m), pos_ (p) {}
+ cache_position&
+ operator= (const cache_position& p)
+ {
+ // It might not be ok to use an uninitialized iterator on the rhs.
+ //
+ if (p.map_ != 0)
+ pos_ = p.pos_;
+ map_ = p.map_;
+ return *this;
+ }
+
map* map_;
iterator pos_;
};