54 using traits_type = Traits;
57 using string_block_type =
typename traits_type::string_element_block;
58 using integer_block_type =
typename traits_type::integer_element_block;
60 using string_type =
typename string_block_type::value_type;
61 using integer_type =
typename integer_block_type::value_type;
62 using size_type = std::size_t;
68 mdds::mtv::boolean_element_block, mdds::mtv::int8_element_block, mdds::mtv::double_element_block,
69 typename traits_type::string_element_block,
typename traits_type::integer_element_block>;
72 using store_type = mdds::multi_type_vector<mtv_traits>;
75 using position_type =
typename store_type::position_type;
76 using const_position_type =
typename store_type::const_position_type;
80 using boolean_block_type =
typename mtv::boolean_element_block;
81 using numeric_block_type =
typename mtv::double_element_block;
87 size_pair_type()
noexcept(std::is_fundamental_v<size_type>) : row(0), column(0)
89 size_pair_type(size_type _row, size_type _column)
noexcept(std::is_fundamental_v<size_type>)
90 : row(_row), column(_column)
92 size_pair_type(std::initializer_list<size_type> vs)
97 size_type* ptrs[2] = {&row, &column};
100 for (size_type v : vs)
104 bool operator==(
const size_pair_type& r)
const noexcept(std::is_fundamental_v<size_type>)
106 return row == r.row && column == r.column;
108 bool operator!=(
const size_pair_type& r)
const noexcept(std::is_fundamental_v<size_type>)
110 return !operator==(r);
114 struct element_block_node_type
116 friend class multi_type_matrix;
121 const element_block_type* data;
123 element_block_node_type()
noexcept(std::is_fundamental_v<size_type>);
124 element_block_node_type(
const element_block_node_type& other)
noexcept(std::is_fundamental_v<size_type>);
126 template<
typename _Blk>
127 typename _Blk::const_iterator begin()
const;
129 template<
typename _Blk>
130 typename _Blk::const_iterator end()
const;
133 void assign(
const const_position_type& pos, size_type section_size);
136 static mtm::element_t to_mtm_type(mdds::mtv::element_t mtv_type)
140 case string_block_type::block_type:
141 return mdds::mtm::element_string;
142 case integer_block_type::block_type:
143 return mdds::mtm::element_integer;
144 case mdds::mtv::element_type_double:
145 case mdds::mtv::element_type_boolean:
146 case mdds::mtv::element_type_empty:
148 return static_cast<mtm::element_t
>(mtv_type);
150 throw type_error(
"multi_type_matrix: unknown element type.");
155 template<
typename FuncT>
159 walk_func(FuncT& func) noexcept : m_func(func)
164 element_block_node_type mtm_node;
165 mtm_node.type = to_mtm_type(mtv_node.type);
166 mtm_node.size = mtv_node.size;
167 mtm_node.data = mtv_node.data;
172 static constexpr bool nothrow_default_constructible_v =
173 std::is_nothrow_default_constructible_v<store_type> && std::is_nothrow_default_constructible_v<size_pair_type>;
175 static constexpr bool nothrow_eq_comparable_v =
176 noexcept(std::declval<store_type>() == std::declval<store_type>()) &&
177 noexcept(std::declval<size_pair_type>() == std::declval<size_pair_type>());
223 template<typename _T>
238 template<typename _T>
256 bool operator==(const
multi_type_matrix& other) const noexcept(nothrow_eq_comparable_v);
257 bool operator!=(const
multi_type_matrix& other) const noexcept(nothrow_eq_comparable_v);
273 position_type
position(size_type row, size_type col);
288 position_type
position(const position_type& pos_hint, size_type row, size_type col);
300 const_position_type
position(size_type row, size_type col) const;
314 const_position_type
position(const const_position_type& pos_hint, size_type row, size_type col) const;
352 mtm::element_t
get_type(const const_position_type& pos) const;
360 mtm::element_t
get_type(size_type row, size_type col) const;
446 const string_type&
get_string(size_type row, size_type col) const;
456 const string_type&
get_string(const const_position_type& pos) const;
468 template<typename _T>
469 _T
get(size_type row, size_type col) const;
490 void set_empty(size_type row, size_type col, size_type length);
522 void set(size_type row, size_type col,
double val);
532 position_type
set(const position_type& pos,
double val);
541 void set(size_type row, size_type col,
bool val);
551 position_type
set(const position_type& pos,
bool val);
560 void set(size_type row, size_type col, const string_type& str);
570 position_type
set(const position_type& pos, const string_type& str);
579 void set(size_type row, size_type col, integer_type val);
589 position_type
set(const position_type& pos, integer_type val);
607 template<typename _T>
608 void set(size_type row, size_type col, const _T& it_begin, const _T& it_end);
624 template<typename _T>
625 position_type
set(const position_type& pos, const _T& it_begin, const _T& it_end);
638 template<typename _T>
639 void set_column(size_type col, const _T& it_begin, const _T& it_end);
679 template<typename _T>
680 void copy(size_type rows, size_type cols, const _T& it_begin, const _T& it_end);
692 void resize(size_type rows, size_type cols);
703 template<typename _T>
704 void resize(size_type rows, size_type cols, const _T& value);
740 template<typename FuncT>
759 template<typename FuncT>
772 template<typename FuncT>
793 template<typename FuncT>
797#ifdef MDDS_MULTI_TYPE_MATRIX_DEBUG
800 m_store.dump_blocks(std::cout);
815 inline size_type get_pos(size_type row, size_type col)
const
817 return m_size.row * col + row;
820 inline size_type get_pos(
const const_position_type& pos)
const
822 return pos.first->position + pos.second;