75 typedef size_t size_type;
78 typedef mdds::mtv::element_t element_category_type;
79 using block_funcs =
typename Traits::block_funcs;
108 block(size_type _position, size_type _size);
110 block(
const block& other) =
default;
111 block(block&& other) =
default;
113 void swap(block& other);
114 void clone_to(block& other)
const;
116 block& operator=(
const block&) =
default;
119 struct element_block_deleter
121 void operator()(
const element_block_type* p)
123 block_funcs::delete_block(p);
127 typedef std::vector<block> blocks_type;
129 struct blocks_to_transfer
132 size_type insert_index;
134 blocks_to_transfer();
137 struct iterator_trait
140 typedef blocks_type blocks;
141 typedef typename blocks_type::iterator base_iterator;
144 struct reverse_iterator_trait
147 typedef blocks_type blocks;
148 typedef typename blocks_type::reverse_iterator base_iterator;
151 struct const_iterator_trait
154 typedef blocks_type blocks;
155 typedef typename blocks_type::const_iterator base_iterator;
158 struct const_reverse_iterator_trait
161 typedef blocks_type blocks;
162 typedef typename blocks_type::const_reverse_iterator base_iterator;
170 typedef detail::iterator_base<iterator_trait, itr_forward_update> iterator;
171 typedef detail::iterator_base<reverse_iterator_trait, itr_no_update> reverse_iterator;
173 typedef detail::const_iterator_base<const_iterator_trait, itr_forward_update, iterator> const_iterator;
174 typedef detail::const_iterator_base<const_reverse_iterator_trait, itr_no_update, reverse_iterator>
175 const_reverse_iterator;
194 typedef std::pair<iterator, size_type> position_type;
195 typedef std::pair<const_iterator, size_type> const_position_type;
257 template<
typename Blk>
258 static typename Blk::value_type
get(
const const_position_type& pos);
521 template<
typename T,
typename... Args>
599 void get(size_type pos, T& value)
const;
613 T
get(size_type pos)
const;
937 void erase(size_type start_pos, size_type end_pos);
1078 template<
typename T>
1081#ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG
1082 void dump_blocks(std::ostream& os)
const;
1084 void check_block_integrity()
const;
1094 void delete_element_block(block& blk);
1103 void delete_element_blocks(
typename blocks_type::iterator it,
typename blocks_type::iterator it_end);
1105 template<
typename T>
1106 iterator set_impl(size_type pos, size_type block_index,
const T& value);
1108 template<
typename T>
1109 iterator release_impl(size_type pos, size_type block_index, T& value);
1111 template<
typename T>
1112 iterator push_back_impl(T&& value);
1114 template<
typename T,
typename... Args>
1115 iterator emplace_back_impl(Args&&... args);
1126 size_type get_block_position(size_type row, size_type start_block_index = 0)
const;
1134 void resize_impl(size_type new_size);
1136 template<
typename T>
1139 template<
typename T,
typename... Args>
1140 void create_new_block_with_emplace_back(
element_block_type*& data,
const T& t, Args&&... args);
1142 template<
typename T>
1143 iterator set_cell_to_middle_of_block(size_type block_index, size_type pos_in_block,
const T& cell);
1145 template<
typename T>
1146 void append_cell_to_block(size_type block_index,
const T& cell);
1148 template<
typename T>
1149 iterator set_cell_to_empty_block(size_type block_index, size_type pos_in_block,
const T& cell);
1151 template<
typename T>
1152 iterator set_cell_to_block_of_size_one(size_type block_index,
const T& cell);
1154 template<
typename T>
1155 void set_cell_to_top_of_data_block(size_type block_index,
const T& cell);
1157 template<
typename T>
1158 void set_cell_to_bottom_of_data_block(size_type block_index,
const T& cell);
1161 size_type start_pos, size_type end_pos, size_type block_index1,
multi_type_vector& dest, size_type dest_pos);
1167 size_type start_pos, size_type end_pos, size_type block_index1,
multi_type_vector& dest, size_type dest_pos);
1174 size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2,
multi_type_vector& dest,
1175 size_type dest_pos);
1185 iterator set_empty_impl(size_type start_pos, size_type end_pos, size_type block_index1,
bool overwrite);
1188 multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1,
1189 size_type block_index2, size_type dblock_index1, size_type dblock_index2);
1191 void swap_single_block(
1192 multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index,
1193 size_type other_block_index);
1195 void swap_single_to_multi_blocks(
1196 multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index,
1197 size_type dst_block_index1, size_type dst_block_index2);
1199 void swap_multi_to_multi_blocks(
1200 multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1,
1201 size_type block_index2, size_type dblock_index1, size_type dblock_index2);
1203 void insert_blocks_at(size_type
position, size_type insert_pos, blocks_type& new_blocks);
1205 void prepare_blocks_to_transfer(
1206 blocks_to_transfer& bucket, size_type block_index1, size_type offset1, size_type block_index2,
1209 iterator set_whole_block_empty(size_type block_index,
bool overwrite);
1211 iterator set_empty_in_single_block(size_type start_row, size_type end_row, size_type block_index,
bool overwrite);
1222 iterator set_empty_in_multi_blocks(
1223 size_type start_row, size_type end_row, size_type block_index1, size_type block_index2,
bool overwrite);
1225 void erase_impl(size_type start_pos, size_type end_pos);
1226 void erase_in_single_block(size_type start_pos, size_type end_pos, size_type block_pos);
1233 iterator insert_empty_impl(size_type pos, size_type block_index, size_type length);
1235 template<
typename T>
1237 size_type row, size_type end_row, size_type block_index1,
const T& it_begin,
const T& it_end);
1239 template<
typename T>
1240 iterator insert_cells_impl(size_type row, size_type block_index,
const T& it_begin,
const T& it_end);
1242 template<
typename T>
1243 iterator set_cells_to_single_block(
1244 size_type start_row, size_type end_row, size_type block_index,
const T& it_begin,
const T& it_end);
1246 template<
typename T>
1247 iterator set_cells_to_multi_blocks(
1248 size_type start_row, size_type end_row, size_type block_index1, size_type block_index2,
const T& it_begin,
1251 template<
typename T>
1252 iterator set_cells_to_multi_blocks_block1_non_equal(
1253 size_type start_row, size_type end_row, size_type block_index1, size_type block_index2,
const T& it_begin,
1256 template<
typename T>
1257 iterator set_cells_to_multi_blocks_block1_non_empty(
1258 size_type start_row, size_type end_row, size_type block_index1, size_type block_index2,
const T& it_begin,
1269 size_type merge_with_adjacent_blocks(size_type block_index);
1278 bool merge_with_next_block(size_type block_index);
1280 template<
typename T>
1281 bool append_to_prev_block(
1282 size_type block_index, element_category_type cat, size_type length,
const T& it_begin,
const T& it_end);
1284 template<
typename T>
1285 void insert_cells_to_middle(size_type row, size_type block_index,
const T& it_begin,
const T& it_end);
1300 block& set_new_block_to_middle(size_type block_index, size_type offset, size_type new_block_size,
bool overwrite);
1302 block* get_previous_block_of_type(size_type block_index, element_category_type cat);
1311 block* get_next_block_of_type(size_type block_index, element_category_type cat);
1331 const element_block_type& src_data, size_type src_offset, size_type dst_index, size_type dst_offset,
1334 void exchange_elements(
1335 const element_block_type& src_data, size_type src_offset, size_type dst_index1, size_type dst_offset1,
1336 size_type dst_index2, size_type dst_offset2, size_type len, blocks_type& new_blocks);
1338 bool append_empty(size_type len);
1340 inline iterator get_iterator(size_type block_index)
1342 typename blocks_type::iterator block_pos = m_blocks.begin();
1343 std::advance(block_pos, block_index);
1344 return iterator(block_pos, m_blocks.end(),
this, block_index);
1347 inline const_iterator get_const_iterator(size_type block_index)
const
1349 typename blocks_type::const_iterator block_pos = m_blocks.begin();
1350 std::advance(block_pos, block_index);
1351 return const_iterator(block_pos, m_blocks.end(),
this, block_index);
1355 using adjust_block_positions_func = detail::adjust_block_positions<blocks_type, Traits::loop_unrolling>;
1358 blocks_type m_blocks;
1359 size_type m_cur_size;