59#include <initializer_list>
64#ifndef DOXYGEN_SHOULD_SKIP_THIS
65 template <
typename Key,
bool >
67 template <
typename Key >
69 template <
typename Key >
71 template <
typename Key >
73 template <
typename Key >
108 template <
typename Key,
bool Gen >
294 const Key& operator[](
Idx i) const;
381 template < typename... Args >
524#ifndef DOXYGEN_SHOULD_SKIP_THIS
545 template <
typename Key >
559 using iterator = SequenceIterator< Key >;
764 bool empty()
const noexcept;
796 template <
typename... Args >
860 const Key&
front()
const;
867 const Key&
back()
const;
896 std::vector< Key >
_v_;
971 template <
typename Key >
1007 Sequence(std::initializer_list< Key > list);
1066#ifndef DOXYGEN_SHOULD_SKIP_THIS
1070 template <
bool gen >
1071 struct SequenceIteratorGet {
1072 template <
typename Key >
1073 INLINE
static const Key& op_star(
const Key* x) {
1077 template <
typename Key >
1078 INLINE
static const Key* op_arrow(
const Key* x) {
1084 struct SequenceIteratorGet< true > {
1085 template <
typename Key >
1086 INLINE
static const Key& op_star(
const Key& x) {
1090 template <
typename Key >
1091 INLINE
static const Key* op_arrow(
const Key& x) {
1133 template <
typename Key >
1136 template <
typename K,
bool >
1153 using Getter = SequenceIteratorGet< std::is_scalar< Key >::value >;
1168 template <
bool Gen >
1312 const Key& operator*() const;
1320 const Key* operator->() const;
1356 template < typename Key >
1362#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
The class for generic Hash Tables.
The internal class for storing (ordered) sequences of objects.
const iterator & end() const noexcept
std::string toString() const
const Key & const_reference
Types for STL compliance.
void _copy_(const SequenceImplementation< Key, Gen > &aSeq)
SequenceIteratorSafe< Key > iterator_safe
Types for STL compliance.
iterator_safe beginSafe() const
SequenceImplementation< Key, Gen > & operator=(const SequenceImplementation< Key, Gen > &aSeq)
Copy operator.
SequenceImplementation< Key, Gen > & operator<<(const Key &k)
Insert k at the end of the sequence (synonym for insert).
const Key & front() const
void emplace(Args &&... args)
void _update_end_() noexcept
SequenceImplementation(const SequenceImplementation< Key, Gen > &aSeq)
Copy constructor.
void _insert_(HashTableBucket< Key, Idx > &&bucket)
Key value_type
Types for STL compliance.
SequenceIteratorSafe< Key > _rend_safe_
SequenceImplementation(SequenceImplementation< Key, Gen > &&aSeq)
Move constructor.
bool operator==(const SequenceImplementation< Key, Gen > &k) const
Returns true if the content of k equals that of *this.
const iterator_safe & endSafe() const noexcept
Size size() const noexcept
Key & reference
Types for STL compliance.
bool exists(const Key &k) const
const iterator & rend() const noexcept
const Key & operator[](Idx i) const
Returns the element at position i (synonym for atPos).
bool operator!=(const SequenceImplementation< Key, Gen > &k) const
Returns true if the content of k is different from that of *this.
SequenceImplementation< Key, Gen > & operator>>(const Key &k)
Remove k in the sequence (synonym for erase).
SequenceImplementation(std::initializer_list< Key > list)
Initializer list constructor.
const iterator_safe & rendSafe() const noexcept
Key * pointer
Types for STL compliance.
~SequenceImplementation() noexcept
Class destructor.
SequenceIteratorSafe< Key > const_iterator_safe
Types for STL compliance.
SequenceIterator< Key > const_iterator
Types for STL compliance.
std::size_t size_type
Types for STL compliance.
std::ptrdiff_t difference_type
Types for STL compliance.
const Key & atPos(Idx i) const
bool empty() const noexcept
SequenceImplementation(Size size_param=HashTableConst::default_size)
Default constructor.
void setAtPos(Idx i, const Key &newKey)
SequenceIteratorSafe< Key > _end_safe_
friend class SequenceIteratorSafe< Key >
Friends to speed up access.
friend class Sequence< Key >
SequenceIterator< Key > iterator
Types for STL compliance.
void resize(Size new_size)
iterator_safe rbeginSafe() const
HashTable< Key, Idx > _h_
void insert(const Key &k)
const Key * const_pointer
Types for STL compliance.
Idx pos(const Key &key) const
Safe iterators for Sequence.
void _setAtEnd_() noexcept
The iterator points to the end (which is pos size()-1).
Key * pointer
types for STL compliance
SequenceIteratorGet< std::is_scalar< Key >::value > Getter
The Getter used by this iterator.
const Key * const_pointer
types for STL compliance
const Key & const_reference
types for STL compliance
const SequenceImplementation< Key, std::is_scalar< Key >::value > * _seq_
The sequence pointed to by the iterator (by default, key is a scalar).
void _setAtRend_() noexcept
The iterator points to rend.
Idx _iterator_
The index in the sequence's vector where the iterator is pointing.
std::ptrdiff_t difference_type
types for STL compliance
Idx pos() const
Returns the position of the iterator in the sequence.
SequenceIteratorSafe(const SequenceImplementation< Key, Gen > &seq, Idx pos=0) noexcept
Constructor, always give a valid iterator (even if pos too large).
void _setPos_(Idx pos) noexcept
The iterator points to the posth element (0 = beginning of the sequence).
Key value_type
types for STL compliance
friend class SequenceImplementation
Friend to speed up access.
std::bidirectional_iterator_tag iterator_category
types for STL compliance
Key & reference
types for STL compliance
The generic class for storing (ordered) sequences of objects.
Key value_type
Types for STL compliance.
SequenceIteratorSafe< Key > const_iterator_safe
Types for STL compliance.
const Key * const_pointer
Types for STL compliance.
SequenceIterator< Key > const_iterator
Types for STL compliance.
Key & reference
Types for STL compliance.
std::ptrdiff_t difference_type
Types for STL compliance.
SequenceIteratorSafe< Key > iterator_safe
Types for STL compliance.
Sequence(Size size_param=HashTableConst::default_size)
Default constructor.
const Key & const_reference
Types for STL compliance.
std::size_t size_type
Types for STL compliance.
SequenceImplementation< Key, std::is_scalar< Key >::value > Implementation
The gum::Sequence implementation.
Key * pointer
Types for STL compliance.
SequenceIterator< Key > iterator
Types for STL compliance.
Set< Key > diffSet(const Sequence< Key > &seq) const
Difference between two sequences as a Set<Key> = this \ seq.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
gum is the global namespace for all aGrUM entities
Template implementation file of gum::Sequence, a class for storing (ordered) sequences of objects.
A recipient for a pair of key value in a gum::HashTableList.
static constexpr Size default_size
The default number of slots in hashtables.