Util--  1.1
simple_memory.hh
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * $Id: simple_memory.hh 953 2005-02-17 21:08:23Z fpy $
3  */
4 #ifndef UTILMM_SMART_SIMPLE_MEMORY_HEADER
5 # define UTILMM_SMART_SIMPLE_MEMORY_HEADER
6 
7 # include <utility>
8 
9 namespace utilmm {
10  namespace smart {
11  namespace ref_count {
12 
29  template<typename Ty>
30  struct simple_memory {
32  typedef Ty base_type;
34  typedef std::pair<base_type, size_t> cell_type;
36  typedef cell_type *mem_cell;
37 
45  return mem_cell(0);
46  }
47 
62  return new cell_type(ptr, 0);
63  }
64 
72  void destroy(mem_cell c) {
73  delete c->first;
74  delete c;
75  }
76 
77  }; // class utilmm::smart::ref_count::simple_memory<>
78 
79  } // namespace utilmm::smart::ref_count
80  } // namespace utilmm::smart
81 } // namespace utilmm
82 
83 #endif // UTILMM_SMART_SIMPLE_MEMORY_HEADER
84 
cell_type * mem_cell
public memory cell type
Definition: simple_memory.hh:36
mem_cell create(base_type *ptr)
Attachment of a new pointer.
Definition: simple_memory.hh:61
Ty base_type
Real type for memory cells.
Definition: simple_memory.hh:32
mem_cell null_cell()
null cell creation
Definition: simple_memory.hh:44
std::pair< base_type, size_t > cell_type
memory cell type
Definition: simple_memory.hh:34
void destroy(mem_cell c)
Destroy a memory cell.
Definition: simple_memory.hh:72
simple memory manager for utilmm::smart::ref_count::manager
Definition: simple_memory.hh:30

Generated on Tue Oct 9 2018 10:12:45 for Util-- by doxygen 1.8.6
SourceForge.net Project Page