8#ifndef META_OCEAN_BASE_SHIFT_VECTOR_H
9#define META_OCEAN_BASE_SHIFT_VECTOR_H
43 using Iterator =
typename std::deque<T>::iterator;
238 inline void insert(
const Index index,
const T& element,
const T& intermediateElement);
259 inline void insert(
const Index index, T&& element,
const T& intermediateElement);
341 explicit inline operator bool()
const;
378 *
this = std::move(
object);
409 for (
size_t n = 0; n <
size; ++n)
529 elements_.push_front(std::move(element));
708 object.firstIndex_ = 0;
751 return !(*
this == object);
typename std::deque< T >::iterator Iterator
Definition of a data iterator.
Definition ShiftVector.h:43
ShiftVector(const Index firstIndex)
Creates a new shift vector object.
Definition ShiftVector.h:382
void resize(const size_t size, const T &element)
Changes the number of elements of this vector.
Definition ShiftVector.h:502
bool isValidIndex(const Index index) const
Returns whether a specific index is valid for this vector and matches to the current offset layout.
Definition ShiftVector.h:646
const T & operator[](const Index index) const
Returns one element of this object.
Definition ShiftVector.h:717
ShiftVector< T > & operator=(ShiftVector< T > &&object) noexcept
Move operator.
Definition ShiftVector.h:703
ShiftVector(ShiftVector< T > &&object) noexcept
Move constructor.
Definition ShiftVector.h:376
T & operator[](const Index index)
Returns one element of this object.
Definition ShiftVector.h:727
void insert(const Index index, T &&element, const T &intermediateElement)
Inserts (or overwrites) an element at a specific position of this vector.
Definition ShiftVector.h:622
const T & back() const
Returns the element located at the last (including) index.
Definition ShiftVector.h:472
bool operator==(const ShiftVector< T > &object) const
Compares two shift vector objects whether they are equal.
Definition ShiftVector.h:743
ShiftVector(const Index firstIndex, const T *elements, const size_t size)
Creates a new shift vector object and copies a specified number of elements.
Definition ShiftVector.h:405
Index endIndex() const
Returns the index of the element behind the last (excluding) element of this object.
Definition ShiftVector.h:435
T Type
Definition of the data type of each element of this object.
Definition ShiftVector.h:33
void resize(const size_t size)
Changes the number of elements of this vector.
Definition ShiftVector.h:496
void insert(const Index index, T &&element)
Inserts (or overwrites) an element at a specific position of this vector.
Definition ShiftVector.h:598
ShiftVector(const ShiftVector< T > &object)
Copy constructor.
Definition ShiftVector.h:368
std::ptrdiff_t Index
Definition of an element index.
Definition ShiftVector.h:38
ShiftVector(const Index firstIndex, const size_t size, const T &element)
Creates a new shift vector object.
Definition ShiftVector.h:397
typename std::deque< T >::const_iterator ConstIterator
Definition of a const data iterator.
Definition ShiftVector.h:48
void pushBack(const T &element)
Adds a new element to the end of this vector.
Definition ShiftVector.h:508
std::deque< StrengthCandidateRow > elements_
Definition ShiftVector.h:364
ConstIterator begin() const
Returns the iterator for the first data element.
Definition ShiftVector.h:676
T & front()
Returns the element located at the first index.
Definition ShiftVector.h:463
void pushFront(T &&element)
Adds a new element to the front of this vector.
Definition ShiftVector.h:527
void popFront()
Removes an element form the front of this vector.
Definition ShiftVector.h:541
bool operator!=(const ShiftVector< T > &object) const
Compares two shift vector object whether they are not equal.
Definition ShiftVector.h:749
void pushFront(const T &element)
Adds a new element to the front of this vector.
Definition ShiftVector.h:520
ShiftVector()=default
Creates a new shift vector object.
void clear()
Clears this object, the specified index shift will be untouched.
Definition ShiftVector.h:658
Index firstIndex_
Definition ShiftVector.h:361
bool isEmpty() const
Returns whether this object holds no element.
Definition ShiftVector.h:652
ConstIterator end() const
Returns the end iterator.
Definition ShiftVector.h:688
void setFirstIndex(const Index index)
Sets the index of the first element of this vector.
Definition ShiftVector.h:448
Iterator begin()
Returns the iterator for the first data element.
Definition ShiftVector.h:670
void popBack()
Removes an element from the end of this vector.
Definition ShiftVector.h:534
Index lastIndex() const
Returns the index of the last (including) element of this object.
Definition ShiftVector.h:422
ShiftVector< T > & operator=(const ShiftVector< T > &object)
Assign operator.
Definition ShiftVector.h:694
Iterator end()
Returns the end iterator.
Definition ShiftVector.h:682
T & back()
Returns the element located at the last (including) index.
Definition ShiftVector.h:481
void insert(const Index index, const T &element)
Inserts (or overwrites) an element at a specific position of this vector.
Definition ShiftVector.h:549
ShiftVector(const Index firstIndex, const size_t size)
Creates a new shift vector object.
Definition ShiftVector.h:389
std::vector< T > data() const
Returns a vector storing the elements.
Definition ShiftVector.h:664
void insert(const Index index, const T &element, const T &intermediateElement)
Inserts (or overwrites) an element at a specific position of this vector.
Definition ShiftVector.h:573
void pushBack(T &&element)
Adds a new element to the end of this vector.
Definition ShiftVector.h:514
const T & front() const
Returns the element located at the first index.
Definition ShiftVector.h:454
The namespace covering the entire Ocean framework.
Definition Accessor.h:15