From b366c3176462d470e445bc8aeb93a13df87e0518 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Jan 2013 12:51:22 +0200 Subject: Cleanup object cache position type --- odb/session.hxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'odb/session.hxx') diff --git a/odb/session.hxx b/odb/session.hxx index cfeebce..f9c8739 100644 --- a/odb/session.hxx +++ b/odb/session.hxx @@ -83,22 +83,26 @@ namespace odb // Object cache. // public: + // Position in the cache of an inserted element. The requirements + // for this class template are: default and copy-constructible and + // copy-assignable. In particular, a standard iterator can be used + // as a position. + // template - struct object_position + struct position { - typedef T object_type; - typedef object_map map; + typedef object_map map; typedef typename map::iterator iterator; - object_position (): map_ (0) {} - object_position (map& m, const iterator& p): map_ (&m), pos_ (p) {} + position () {} + position (map& m, const iterator& p): map_ (&m), pos_ (p) {} map* map_; iterator pos_; }; template - object_position + position insert (database_type&, const typename object_traits::id_type&, const typename object_traits::pointer_type&); @@ -113,7 +117,7 @@ namespace odb template void - erase (const object_position&); + erase (const position&); protected: typedef std::map