29 #ifndef INCLUDED_MDDS_MULTI_TYPE_VECTOR_DIR_CUSTOM_FUNC3_HPP
30 #define INCLUDED_MDDS_MULTI_TYPE_VECTOR_DIR_CUSTOM_FUNC3_HPP
35 namespace mdds {
namespace mtv {
37 template<
typename _Block1,
typename _Block2,
typename _Block3>
44 case _Block1::block_type:
45 return _Block1::create_block(init_size);
46 case _Block2::block_type:
47 return _Block2::create_block(init_size);
48 case _Block3::block_type:
49 return _Block3::create_block(init_size);
53 return element_block_func::create_new_block(type, init_size);
58 switch (get_block_type(block))
60 case _Block1::block_type:
61 return _Block1::clone_block(block);
62 case _Block2::block_type:
63 return _Block2::clone_block(block);
64 case _Block3::block_type:
65 return _Block3::clone_block(block);
69 return element_block_func::clone_block(block);
77 switch (get_block_type(*p))
79 case _Block1::block_type:
80 _Block1::delete_block(p);
82 case _Block2::block_type:
83 _Block2::delete_block(p);
85 case _Block3::block_type:
86 _Block3::delete_block(p);
89 element_block_func::delete_block(p);
95 switch (get_block_type(block))
97 case _Block1::block_type:
98 _Block1::resize_block(block, new_size);
100 case _Block2::block_type:
101 _Block2::resize_block(block, new_size);
103 case _Block3::block_type:
104 _Block3::resize_block(block, new_size);
107 element_block_func::resize_block(block, new_size);
113 switch (get_block_type(block))
115 case _Block1::block_type:
116 _Block1::print_block(block);
118 case _Block2::block_type:
119 _Block2::print_block(block);
121 case _Block3::block_type:
122 _Block3::print_block(block);
125 element_block_func::print_block(block);
131 switch (get_block_type(block))
133 case _Block1::block_type:
134 _Block1::erase_block(block, pos);
136 case _Block2::block_type:
137 _Block2::erase_block(block, pos);
139 case _Block3::block_type:
140 _Block3::erase_block(block, pos);
143 element_block_func::erase(block, pos);
149 switch (get_block_type(block))
151 case _Block1::block_type:
152 _Block1::erase_block(block, pos, size);
154 case _Block2::block_type:
155 _Block2::erase_block(block, pos, size);
157 case _Block3::block_type:
158 _Block3::erase_block(block, pos, size);
161 element_block_func_base::erase(block, pos, size);
167 switch (get_block_type(dest))
169 case _Block1::block_type:
170 _Block1::append_values_from_block(dest, src);
172 case _Block2::block_type:
173 _Block2::append_values_from_block(dest, src);
175 case _Block3::block_type:
176 _Block3::append_values_from_block(dest, src);
179 element_block_func_base::append_values_from_block(dest, src);
183 static void append_values_from_block(
186 switch (get_block_type(dest))
188 case _Block1::block_type:
189 _Block1::append_values_from_block(dest, src, begin_pos, len);
191 case _Block2::block_type:
192 _Block2::append_values_from_block(dest, src, begin_pos, len);
194 case _Block3::block_type:
195 _Block3::append_values_from_block(dest, src, begin_pos, len);
198 element_block_func_base::append_values_from_block(dest, src, begin_pos, len);
202 static void assign_values_from_block(
205 switch (get_block_type(dest))
207 case _Block1::block_type:
208 _Block1::assign_values_from_block(dest, src, begin_pos, len);
210 case _Block2::block_type:
211 _Block2::assign_values_from_block(dest, src, begin_pos, len);
213 case _Block3::block_type:
214 _Block3::assign_values_from_block(dest, src, begin_pos, len);
217 element_block_func_base::assign_values_from_block(dest, src, begin_pos, len);
221 static void prepend_values_from_block(
224 switch (get_block_type(dest))
226 case _Block1::block_type:
227 _Block1::prepend_values_from_block(dest, src, begin_pos, len);
229 case _Block2::block_type:
230 _Block2::prepend_values_from_block(dest, src, begin_pos, len);
232 case _Block3::block_type:
233 _Block3::prepend_values_from_block(dest, src, begin_pos, len);
236 element_block_func_base::prepend_values_from_block(dest, src, begin_pos, len);
242 switch (get_block_type(blk1))
244 case _Block1::block_type:
245 _Block1::swap_values(blk1, blk2, pos1, pos2, len);
247 case _Block2::block_type:
248 _Block2::swap_values(blk1, blk2, pos1, pos2, len);
250 case _Block3::block_type:
251 _Block3::swap_values(blk1, blk2, pos1, pos2, len);
254 element_block_func_base::swap_values(blk1, blk2, pos1, pos2, len);
260 if (get_block_type(left) == _Block1::block_type)
262 if (get_block_type(right) != _Block1::block_type)
265 return _Block1::get(left) == _Block1::get(right);
267 else if (mtv::get_block_type(right) == _Block1::block_type)
270 if (get_block_type(left) == _Block2::block_type)
272 if (get_block_type(right) != _Block2::block_type)
275 return _Block2::get(left) == _Block2::get(right);
277 else if (mtv::get_block_type(right) == _Block2::block_type)
280 if (get_block_type(left) == _Block3::block_type)
282 if (get_block_type(right) != _Block3::block_type)
285 return _Block3::get(left) == _Block3::get(right);
287 else if (mtv::get_block_type(right) == _Block3::block_type)
290 return element_block_func::equal_block(left, right);
295 switch (get_block_type(block))
297 case _Block1::block_type:
298 _Block1::overwrite_values(block, pos, len);
300 case _Block2::block_type:
301 _Block2::overwrite_values(block, pos, len);
303 case _Block3::block_type:
304 _Block3::overwrite_values(block, pos, len);
313 switch (get_block_type(block))
315 case _Block1::block_type:
316 _Block1::shrink_to_fit(block);
318 case _Block2::block_type:
319 _Block2::shrink_to_fit(block);
321 case _Block3::block_type:
322 _Block3::shrink_to_fit(block);
325 element_block_func::shrink_to_fit(block);
331 switch (get_block_type(block))
333 case _Block1::block_type:
334 return _Block1::size(block);
335 case _Block2::block_type:
336 return _Block2::size(block);
337 case _Block3::block_type:
338 return _Block3::size(block);
340 return element_block_func::size(block);
Definition: types.hpp:174
Definition: custom_func3.hpp:39
static void overwrite_values(base_element_block &block, size_t pos, size_t len)
Definition: trait.hpp:658