MCPcopy Create free account
hub / github.com/dengwirda/jigsaw / block_array

Class block_array

src/libcpp/containers/block_array.hpp:71–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69 typename A = allocators::basic_alloc
70 >
71 class block_array
72 {
73/*------ a dynamically allocated, block-wise array object */
74 public :
75 typedef D data_type ;
76 typedef A allocator ;
77
78 typedef __cont::block_array <
79 data_type ,
80 allocator > self_type ;
81
82 typedef typename
83 allocator::size_type size_type ;
84 typedef typename
85 allocator::diff_type diff_type ;
86
87 typedef __cont::const_block_iterator <
88 self_type > _const_it ;
89 typedef __cont::write_block_iterator <
90 self_type > _write_it ;
91
92 typedef __cont::array <
93 data_type ,
94 allocator > leaf_type ;
95 typedef __cont::array <
96 leaf_type ,
97 allocator > root_type ;
98
99 size_type static constexpr _pwr2 = + 14 ;
100 size_type static constexpr _size = +1<<_pwr2 ;
101
102 private :
103
104 root_type _block ;
105 size_type _count ;
106 size_type _alloc ;
107
108 /*
109 --------------------------------------------------------
110 * INC-ALLOC: helper - broaden storage.
111 --------------------------------------------------------
112 */
113
114 __normal_call void_type inc_alloc (
115 size_type _new_count
116 )
117 {
118 if (_new_count <= alloc()) return ;
119 /*-------------------------- alloc. storage in blocks */
120 size_type _new_alloc = alloc();
121 if (_new_count <= _size)
122 { /* grow allocation as multiples of two */
123 _new_alloc =
124 std::max(_new_alloc * 2, _new_count);
125 }
126 else
127 { /* round to the nearest block boundary */
128 _new_alloc =

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected