simple_memory.hh
Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  * $Id: simple_memory.hh 953 2005-02-17 21:08:23Z fpy $
00003  */
00004 #ifndef UTILMM_SMART_SIMPLE_MEMORY_HEADER
00005 # define UTILMM_SMART_SIMPLE_MEMORY_HEADER
00006 
00007 # include <utility>
00008 
00009 namespace utilmm {
00010   namespace smart {
00011     namespace ref_count {
00012 
00029       template<typename Ty>
00030       struct simple_memory {
00032         typedef Ty base_type;
00034         typedef std::pair<base_type, size_t> cell_type;
00036         typedef cell_type *mem_cell;
00037 
00044         mem_cell null_cell() {
00045           return mem_cell(0);
00046         }
00047         
00061         mem_cell create(base_type *ptr) {
00062           return new cell_type(ptr, 0);
00063         }
00064 
00072         void destroy(mem_cell c) {
00073           delete c->first;
00074           delete c;
00075         }
00076 
00077       }; // class utilmm::smart::ref_count::simple_memory<>
00078 
00079     } // namespace utilmm::smart::ref_count
00080   } // namespace utilmm::smart
00081 } // namespace utilmm
00082 
00083 #endif // UTILMM_SMART_SIMPLE_MEMORY_HEADER
00084 


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Wed Sep 16 2015 07:05:43