227 using traits_type = Traits;
229 using element_blocks_type =
typename mtm::detail::element_blocks_of<traits_type>::type;
232 using numeric_block_type =
typename traits_type::numeric_element_block;
233 using numeric_type =
typename numeric_block_type::value_type;
234 using size_type = std::size_t;
248 using block_list_type =
typename mtm::detail::block_list_of<traits_type>::type;
252 "The numeric element block must not also appear in element_blocks.");
256 "All element blocks of the matrix must have distinct block type ids.");
263 using store_type = mdds::multi_type_vector<mtv_traits>;
266 using position_type =
typename store_type::position_type;
267 using const_position_type =
typename store_type::const_position_type;
271 struct size_pair_type
275 size_pair_type()
noexcept(std::is_fundamental_v<size_type>) : row(0), column(0)
277 size_pair_type(size_type _row, size_type _column)
noexcept(std::is_fundamental_v<size_type>)
278 : row(_row), column(_column)
280 size_pair_type(std::initializer_list<size_type> vs)
285 size_type* ptrs[2] = {&row, &column};
286 size_type** p = ptrs;
288 for (size_type v : vs)
292 bool operator==(
const size_pair_type& r)
const noexcept(std::is_fundamental_v<size_type>)
294 return row == r.row && column == r.column;
298 struct element_block_node_type
300 friend class multi_type_matrix;
305 const element_block_type* data;
307 element_block_node_type()
noexcept(std::is_fundamental_v<size_type>);
308 element_block_node_type(
const element_block_node_type& other)
noexcept(std::is_fundamental_v<size_type>);
310 template<
typename _Blk>
311 typename _Blk::const_iterator begin()
const;
313 template<
typename _Blk>
314 typename _Blk::const_iterator end()
const;
317 void assign(
const const_position_type& pos, size_type section_size);
321 template<
typename FuncT>
325 walk_func(FuncT& func) noexcept : m_func(func)
330 element_block_node_type mtm_node;
331 mtm_node.type = mtv_node.type;
332 mtm_node.size = mtv_node.size;
333 mtm_node.data = mtv_node.data;
344 static void validate_type(mtm::element_t type);
355 template<
typename FuncT>
356 static void dispatch_block(mtm::element_t type, FuncT&& func);
363 static store_type create_store(size_type init_size,
const T& it_begin,
const T& it_end);
365 static constexpr bool nothrow_default_constructible_v =
366 std::is_nothrow_default_constructible_v<store_type> && std::is_nothrow_default_constructible_v<size_pair_type>;
368 static constexpr bool nothrow_eq_comparable_v =
369 noexcept(std::declval<store_type>() == std::declval<store_type>()) &&
370 noexcept(std::declval<size_pair_type>() == std::declval<size_pair_type>());
416 template<typename _T>
431 template<typename _T>
449 bool operator==(const
multi_type_matrix& other) const noexcept(nothrow_eq_comparable_v);
465 position_type
position(size_type row, size_type col);
480 position_type
position(const position_type& pos_hint, size_type row, size_type col);
492 const_position_type
position(size_type row, size_type col) const;
506 const_position_type
position(const const_position_type& pos_hint, size_type row, size_type col) const;
545 mtm::element_t
get_type(const const_position_type& pos) const;
557 mtm::element_t
get_type(size_type row, size_type col) const;
595 T
get(size_type row, size_type col) const;
608 T
get(const const_position_type& pos) const;
628 template<mtm::detail::referenceable_value_type<typename mtm::detail::block_list_of<Traits>::type> T>
629 const T&
get_ref(size_type row, size_type col) const;
648 template<mtm::detail::referenceable_value_type<typename mtm::detail::block_list_of<Traits>::type> T>
649 const T&
get_ref(const const_position_type& pos) const;
670 void set_empty(size_type row, size_type col, size_type length);
702 void set(size_type row, size_type col, numeric_type val);
712 position_type
set(const position_type& pos, numeric_type val);
723 template<mtm::detail::listed_value_type<typename mtm::detail::element_blocks_of<Traits>::type> T>
724 void set(size_type row, size_type col, const T& val);
736 template<mtm::detail::listed_value_type<typename mtm::detail::element_blocks_of<Traits>::type> T>
737 position_type
set(const position_type& pos, const T& val);
755 template<typename _T>
756 void set(size_type row, size_type col, const _T& it_begin, const _T& it_end);
772 template<typename _T>
773 position_type
set(const position_type& pos, const _T& it_begin, const _T& it_end);
786 template<typename _T>
787 void set_column(size_type col, const _T& it_begin, const _T& it_end);
827 template<typename _T>
828 void copy(size_type rows, size_type cols, const _T& it_begin, const _T& it_end);
840 void resize(size_type rows, size_type cols);
851 template<typename _T>
852 void resize(size_type rows, size_type cols, const _T& value);
879 template<typename... Blks>
902 template<typename FuncT>
921 template<typename FuncT>
934 template<typename FuncT>
955 template<typename FuncT>
959#ifdef MDDS_MULTI_TYPE_MATRIX_DEBUG
962 m_store.dump_blocks(std::cout);
977 inline size_type get_pos(size_type row, size_type col)
const
979 return m_size.row * col + row;
982 inline size_type get_pos(
const const_position_type& pos)
const
984 return pos.first->position + pos.second;