20 #ifndef ANTKEEPER_GEOM_BREP_ELEMENT_CONTAINER_HPP
21 #define ANTKEEPER_GEOM_BREP_ELEMENT_CONTAINER_HPP
66 return m_it[i]->get();
109 return m_it == other.m_it;
114 return m_it <=> other.m_it;
119 return m_it - rhs.m_it;
162 return m_elements[i].get();
168 return m_elements.front().get();
174 return m_elements.back().get();
186 it.m_it = m_elements.begin();
200 it.m_it = m_elements.end();
213 return std::make_reverse_iterator(
end());
225 return std::make_reverse_iterator(
begin());
238 [[nodiscard]]
inline constexpr
bool empty() const noexcept
240 return m_elements.empty();
244 [[nodiscard]]
inline constexpr std::size_t
size() const noexcept
246 return m_elements.size();
257 return m_attribute_map;
261 return m_attribute_map;
289 const auto index =
element->m_index;
291 for (
auto& [key, values]: m_attribute_map.m_attributes)
293 values->erase(index);
295 --m_attribute_map.m_element_count;
297 m_elements.back()->m_index = index;
298 m_elements[index] = std::move(m_elements.back());
299 m_elements.pop_back();
309 for (
auto& [key, values]: m_attribute_map.m_attributes)
311 values->emplace_back();
313 ++m_attribute_map.m_element_count;
315 return m_elements.emplace_back(std::make_unique<element_type>()).get();
323 std::vector<std::unique_ptr<element_type>> m_elements;
Maps names to B-rep attributes.
Container for B-rep elements.
constexpr std::size_t size() const noexcept
Returns the number of elements in the container.
constexpr const_iterator cend() const noexcept
Returns an iterator to the element following the last element.
constexpr const_reverse_iterator crend() const noexcept
Returns a reverse iterator to the element following the last element of the reversed container.
virtual void erase(element_type *element)
Erases an element from the container.
constexpr const_iterator cbegin() const noexcept
Returns an iterator to the first element.
const brep_attribute_map & attributes() const noexcept
Returns the element attribute map.
brep_attribute_map & attributes() noexcept
Returns the element attribute map.
constexpr element_type * operator[](std::size_t i) const
Returns a pointer to the element at the specified index.
brep_element_container(brep_mesh *mesh) noexcept
Constructs a B-rep element container.
constexpr const_reverse_iterator rend() const noexcept
Returns a reverse iterator to the element following the last element of the reversed container.
constexpr const_iterator begin() const noexcept
Returns an iterator to the first element.
constexpr const_iterator end() const noexcept
Returns an iterator to the element following the last element.
std::reverse_iterator< const_iterator > const_reverse_iterator
constexpr element_type * front() const noexcept
Returns the first element.
constexpr const_reverse_iterator crbegin() const noexcept
Returns a reverse iterator to the first element of the reversed container.
constexpr const_reverse_iterator rbegin() const noexcept
Returns a reverse iterator to the first element of the reversed container.
constexpr bool empty() const noexcept
Returns true if the container is empty, false otherwise.
constexpr element_type * back() const noexcept
Returns the last element.
virtual element_type * emplace_back()
Appends a new element to the end of the container.
Boundary representation (B-rep) of a mesh.
difference_type operator-(const const_iterator &rhs) const noexcept
const_iterator operator-(difference_type n) const noexcept
const_iterator & operator+=(difference_type n) noexcept
const_iterator operator--(int) noexcept
const_iterator & operator-=(difference_type n) noexcept
std::weak_ordering operator<=>(const const_iterator &other) const noexcept
const value_type & reference
constexpr value_type operator*() const noexcept
friend const_iterator operator+(difference_type lhs, const const_iterator &rhs) noexcept
const_iterator & operator++() noexcept
constexpr value_type operator[](difference_type i) const noexcept
const_iterator operator+(difference_type n) const noexcept
const_iterator operator++(int) noexcept
constexpr value_type operator->() const noexcept
const_iterator & operator--() noexcept
std::ptrdiff_t difference_type
friend const_iterator operator-(difference_type lhs, const const_iterator &rhs) noexcept
std::random_access_iterator_tag iterator_category
const value_type * pointer
std::random_access_iterator_tag iterator_concept
element_type * value_type
bool operator==(const const_iterator &other) const noexcept