29 #ifndef INCLUDED_MDDS_MULTI_TYPE_VECTOR_DIR_UTIL_HPP
30 #define INCLUDED_MDDS_MULTI_TYPE_VECTOR_DIR_UTIL_HPP
32 #include "./types.hpp"
93 namespace detail {
namespace mtv {
95 inline void throw_block_position_not_found(
96 const char* method_sig,
int line,
size_t pos,
size_t block_size,
size_t container_size)
98 std::ostringstream os;
99 os << method_sig <<
"#" << line <<
": block position not found! (logical pos="
100 << pos <<
", block size=" << block_size <<
", logical size=" << container_size <<
")";
101 throw std::out_of_range(os.str());
122 template<
typename _T,
typename _SizeT>
123 std::pair<_SizeT, bool> calc_input_end_position(
124 const _T& it_begin,
const _T& it_end, _SizeT pos, _SizeT total_size)
126 using ret_type = std::pair<_SizeT, bool>;
128 _SizeT length = std::distance(it_begin, it_end);
131 return ret_type(0,
false);
133 _SizeT end_pos = pos + length - 1;
134 if (end_pos >= total_size)
135 throw std::out_of_range(
"Input data sequence is too long.");
137 return ret_type(end_pos,
true);
141 T advance_position(
const T& pos,
int steps)
149 if (ret.second + steps < ret.first->size)
157 steps -=
static_cast<int>(ret.first->size - ret.second);
167 if (
static_cast<int>(ret.second) >= -steps)
174 steps +=
static_cast<int>(ret.second + 1);
176 ret.second = ret.first->size - 1;
184 template<
typename _Blk>
187 return _Blk::at(data, offset);
190 #ifndef MDDS_MULTI_TYPE_VECTOR_USE_DEQUE
195 auto it = mdds::mtv::boolean_element_block::cbegin(data);
196 std::advance(it, offset);
Definition: types.hpp:113
static constexpr lu_factor_t loop_unrolling
Definition: util.hpp:88
void element_block_acquired(const base_element_block *block)
Definition: util.hpp:54
void element_block_released(const base_element_block *block)
Definition: util.hpp:67