// file : odb/lazy-ptr-impl.txx // author : Boris Kolpackov // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file #include namespace odb { // // lazy_ptr_base // template void lazy_ptr_base:: free (void* p) { delete static_cast (p); } template void* lazy_ptr_base:: copy (const void* p) { return new T (*static_cast (p)); } // // lazy_ptr_impl // template template inline typename object_traits::pointer_type lazy_ptr_impl:: load (bool reset) { typedef typename object_traits::id_type id_type; typedef typename object_traits::pointer_type pointer_type; const id_type& id (*static_cast (id_)); pointer_type p (db_->load (id)); if (reset) reset_id (); // If you get a compile error pointing here, then you most likely // used a wrong type as a template argument in the load() call. // return p; } }