15 #include <initializer_list>
61 template <
typename value_t>
65 using InputElement =
typename std::pair<GeometryIdentifier, value_t>;
66 using Iterator =
typename std::vector<value_t>::const_iterator;
67 using Size =
typename std::vector<value_t>::size_type;
122 "Incompatible GeometryIdentifier hierarchy");
125 "Incompatible GeometryIdentifier hierarchy");
128 "Incompatible GeometryIdentifier hierarchy");
131 "Incompatible GeometryIdentifier hierarchy");
146 if (
id.sensitive() != 0
u) {
148 return allSet.value();
150 if (
id.approach() != 0
u) {
151 return allSet.setSensitive(0
u).value();
154 return allSet.setSensitive(0
u).setApproach(0
u).value();
156 if (
id.boundary() != 0
u) {
157 return allSet.setSensitive(0
u).setApproach(0
u).setLayer(0
u).value();
160 return allSet.setSensitive(0
u)
176 return (lhs & mask) == (rhs & mask);
179 template <
typename iterator_t>
186 template <
typename iterator_t>
192 template <
typename value_t>
194 std::vector<InputElement> elements) {
195 sortAndCheckDuplicates(elements.begin(), elements.end());
196 fill(elements.begin(), elements.end());
199 template <
typename value_t>
201 std::initializer_list<InputElement> elements)
205 template <
typename value_t>
206 template <
typename iterator_t>
210 std::sort(beg, end, [=](
const auto& lhs,
const auto& rhs) {
211 return lhs.first < rhs.first;
214 auto dup = std::adjacent_find(beg, end, [](
const auto& lhs,
const auto& rhs) {
215 return lhs.first == rhs.first;
218 throw std::invalid_argument(
"Input elements contain duplicates");
222 template <
typename value_t>
223 template <
typename iterator_t>
226 const auto n = std::distance(beg, end);
233 for (; beg != end; ++beg) {
234 m_ids.push_back(beg->first.value());
235 m_masks.push_back(makeLeadingLevelsMask(beg->first.value()));
236 m_values.push_back(std::move(beg->second));
240 template <
typename value_t>
243 assert((m_ids.size() == m_values.size()) and
244 "Inconsistent container state: #ids != # values");
245 assert((m_masks.size() == m_values.size()) and
246 "Inconsistent container state: #masks != #values");
252 const auto it = std::upper_bound(m_ids.begin(), m_ids.end(),
id.value());
253 auto i = std::distance(m_ids.begin(),
it);
274 if (not equalWithinMask(
id.
value(), m_ids[i], makeHighestLevelMask())) {
286 if (equalWithinMask(
id.
value(), m_ids[i], m_masks[i])) {
287 return std::next(begin(), i);