46 template <
typename Container>
57 using pointer =
typename Container::pointer;
67 using iterator_category =
typename std::iterator_traits<typename Container::iterator>::iterator_category;
68 using value_type =
typename std::iterator_traits<typename Container::iterator>::value_type;
69 using difference_type =
typename std::iterator_traits<typename Container::iterator>::difference_type;
70 using pointer =
typename std::iterator_traits<typename Container::iterator>::pointer;
71 using reference =
typename std::iterator_traits<typename Container::iterator>::reference;
154 typename Container::iterator m_it;
160 Iterator(
typename Container::iterator it);
170 using iterator_category =
typename std::iterator_traits<typename Container::const_iterator>::iterator_category;
171 using value_type =
typename std::iterator_traits<typename Container::const_iterator>::value_type;
172 using difference_type =
typename std::iterator_traits<typename Container::const_iterator>::difference_type;
173 using pointer =
typename std::iterator_traits<typename Container::const_iterator>::pointer;
174 using reference =
typename std::iterator_traits<typename Container::const_iterator>::reference;
257 typename Container::const_iterator m_it;
431 auto operator[](K const& key) -> decltype(auto)
432 requires (Type::HasMappedType<Container>);
442 auto operator[](K const& key) const -> decltype(auto)
443 requires (Type::HasMappedType<const Container>);
470 (Type::LvalueReference<T> && Type::CopyConstructible<
value_type>) ||
471 (!Type::LvalueReference<T> && Type::MoveConstructible<
value_type>)
499 requires Type::HasMappedType<const Container> &&
std::convertible_to<M, typename Container::mapped_type>;
509 requires Type::HasMappedType<const Container>;
513#include <StormByte/iterable.txx>
Const iterator adapter over Container::const_iterator.
Definition iterable.hxx:167
ConstIterator operator++(int)
Post-increment.
ConstIterator & operator-=(difference_type n)
Retreat in place.
ConstIterator & operator--()
Pre-decrement.
typename std::iterator_traits< typename Container::const_iterator >::iterator_category iterator_category
Matches the underlying container iterator; not assumed random-access.
Definition iterable.hxx:170
ConstIterator operator-(difference_type n) const
Iterator moved back by n.
typename std::iterator_traits< typename Container::const_iterator >::value_type value_type
Definition iterable.hxx:171
reference operator*() const
Dereference.
pointer operator->() const
Member access.
typename std::iterator_traits< typename Container::const_iterator >::pointer pointer
Definition iterable.hxx:173
ConstIterator operator+(difference_type n) const
Iterator advanced by n.
bool operator!=(const ConstIterator &other) const
Inequality.
ConstIterator & operator++()
Pre-increment.
ConstIterator operator--(int)
Post-decrement.
bool operator==(const ConstIterator &other) const
Equality.
typename std::iterator_traits< typename Container::const_iterator >::difference_type difference_type
Definition iterable.hxx:172
typename std::iterator_traits< typename Container::const_iterator >::reference reference
Definition iterable.hxx:174
difference_type operator-(const ConstIterator &other) const
Distance to other.
ConstIterator & operator+=(difference_type n)
Advance in place.
Mutable iterator adapter over Container::iterator.
Definition iterable.hxx:64
Iterator & operator++()
Pre-increment.
bool operator!=(const Iterator &other) const
Inequality.
typename std::iterator_traits< typename Container::iterator >::difference_type difference_type
Definition iterable.hxx:69
reference operator*()
Dereference.
typename std::iterator_traits< typename Container::iterator >::value_type value_type
Definition iterable.hxx:68
Iterator & operator+=(difference_type n)
Advance in place.
typename std::iterator_traits< typename Container::iterator >::pointer pointer
Definition iterable.hxx:70
Iterator operator++(int)
Post-increment.
Iterator operator--(int)
Post-decrement.
Iterator & operator-=(difference_type n)
Retreat in place.
Iterator operator+(difference_type n) const
Iterator advanced by n.
bool operator==(const Iterator &other) const
Equality.
Iterator & operator--()
Pre-decrement.
Iterator operator-(difference_type n) const
Iterator moved back by n.
typename std::iterator_traits< typename Container::iterator >::reference reference
Definition iterable.hxx:71
typename std::iterator_traits< typename Container::iterator >::iterator_category iterator_category
Matches the underlying container iterator; not assumed random-access.
Definition iterable.hxx:67
pointer operator->()
Member access.
difference_type operator-(const Iterator &other) const
Distance to other.
Wrapper that adds a uniform iteration and mutation API around a standard container.
Definition iterable.hxx:47
Iterable(C &&data)
Builds from a container.
const_reverse_iterator crbegin() const noexcept
Const reverse begin.
const_iterator cend() const noexcept
Const end.
typename Container::size_type size_type
Container::size_type.
Definition iterable.hxx:53
std::reverse_iterator< iterator > reverse_iterator
Mutable reverse adapter.
Definition iterable.hxx:268
reverse_iterator rend() noexcept
Mutable reverse end.
Iterable(Iterable &&)=default
Move constructor.
bool has_key(const K &key) const
Key lookup for associative containers.
bool has_item(const value_type &value) const
Linear search for an equal element.
iterator end() noexcept
Mutable end.
const_iterator cbegin() const noexcept
Const begin.
reverse_iterator rbegin() noexcept
Mutable reverse begin.
Iterable()=default
Empty iterable.
typename Container::value_type value_type
Container::value_type.
Definition iterable.hxx:52
bool empty() const noexcept
Whether the container is empty.
Iterable(const Iterable &other)
Copy constructor.
void add(T &&value)
Inserts value via push_back, else push_front, else associative insert.
typename Container::const_pointer const_pointer
Container::const_pointer.
Definition iterable.hxx:58
typename Container::pointer pointer
Container::pointer.
Definition iterable.hxx:57
size_type size() const noexcept
Element count.
Container m_data
Underlying container.
Definition iterable.hxx:49
typename Container::reference reference
Container::reference.
Definition iterable.hxx:55
typename Container::difference_type difference_type
Container::difference_type.
Definition iterable.hxx:54
std::reverse_iterator< const_iterator > const_reverse_iterator
Const reverse adapter.
Definition iterable.hxx:269
iterator begin() noexcept
Mutable begin.
const_reverse_iterator crend() const noexcept
Const reverse end.
typename Container::const_reference const_reference
Container::const_reference.
Definition iterable.hxx:56
Type that can actually be copy-constructed.
Definition object_semantics.hxx:136
Lvalue reference type (std::is_lvalue_reference).
Definition categories.hxx:65
Type that can be move-constructed.
Definition object_semantics.hxx:189
Same type after stripping cv and references from both sides.
Definition relations.hxx:65
Root namespace of the StormByte suite.