35 #ifndef OPENMS_DATASTRUCTURES_CONSTREFVECTOR_H 36 #define OPENMS_DATASTRUCTURES_CONSTREFVECTOR_H 70 template <
typename ContainerT>
76 template <
class ValueT>
95 vector_ = (
typename std::vector<ValueType*>*)vec;
116 if (
this == &rhs)
return *
this;
241 template <
class ValueT>
378 typedef typename ContainerType::pointer
pointer;
389 const ValueType* element = &x;
432 return Iterator((std::vector<const ValueType*>*) &
vector_, (
unsigned int)0);
438 return Iterator((std::vector<const ValueType*>*) &
vector_, (
unsigned int)(vector_.size()));
450 return ConstIterator((
const std::vector<const ValueType*>*) &
vector_, (
unsigned int)(vector_.size()));
472 ConstReverseIterator
rend()
const 485 void resize(size_type new_size,
const ValueType& t)
589 Iterator
insert(Iterator pos,
const ValueType& element)
591 const ValueType* pointer = &element;
597 void insert(Iterator pos, size_type n,
const ValueType& element)
600 std::vector<const ValueType*> tmp;
601 for (size_type i = 0; i < n; i++)
604 tmp.push_back(pointer);
610 template <
class InputIterator>
611 void insert(Iterator pos, InputIterator f, InputIterator l)
614 std::vector<const ValueType*> tmp;
615 for (InputIterator it = f; it != l; ++it)
618 tmp.push_back(pointer);
631 Iterator
erase(Iterator first, Iterator last)
651 vector_ = std::vector<const ValueType*>(n);
659 vector_ = std::vector<const ValueType*>(n, &element);
667 const ValueType* element;
668 for (ConstIterator it = p.
begin(); it != p.
end(); ++it)
676 template <
class InputIterator>
682 for (InputIterator it = f; it != l; ++it)
694 const ValueType* element;
695 for (
typename ContainerType::iterator it = p.begin(); it != p.end(); ++it)
712 if (
this == &rhs)
return *
this;
717 const ValueType* element;
718 for (ConstIterator it = rhs.
begin(); it != rhs.
end(); ++it)
728 template <
class InputIterator>
729 void assign(InputIterator f, InputIterator l)
736 void assign(size_type n,
const ValueType& x)
785 template <
typename ComparatorType>
807 #endif // OPENMS_DATASTRUCTURES_CONSTREFVECTOR_H ConstRefVectorIterator(const ConstRefVectorIterator< ValueType > &it)
Definition: ConstRefVector.h:266
ConstRefVectorConstIterator< ValueType >::value_type & reference
Definition: ConstRefVector.h:250
ContainerT ContainerType
Type definitions.
Definition: ConstRefVector.h:362
std::vector< ValueType * > * vector_
Definition: ConstRefVector.h:235
bool operator<=(const ConstRefVector &array) const
Comparison of container sizes.
Definition: ConstRefVector.h:565
Iterator iterator
Definition: ConstRefVector.h:379
~ConstRefVector()
See std::vector documentation.
Definition: ConstRefVector.h:703
ContainerType::pointer pointer
Definition: ConstRefVector.h:378
pointer operator->() const
Definition: ConstRefVector.h:285
ConstRefVectorIterator()
Definition: ConstRefVector.h:257
ValueT ValueType
Definition: ConstRefVector.h:249
ConstRefVectorConstIterator operator-(difference_type n) const
Definition: ConstRefVector.h:180
ConstRefVector & operator=(const ConstRefVector &rhs)
See std::vector documentation.
Definition: ConstRefVector.h:710
Iterator insert(Iterator pos, const ValueType &element)
See std::vector documentation.
Definition: ConstRefVector.h:589
void resize(size_type new_size, const ValueType &t)
See std::vector documentation.
Definition: ConstRefVector.h:485
pointer operator->()
Definition: ConstRefVector.h:223
ConstRefVectorConstIterator< ValueType >::value_type * pointer
Definition: ConstRefVector.h:251
ConstRefVectorConstIterator operator++(int)
Definition: ConstRefVector.h:160
Iterator erase(Iterator pos)
See std::vector documentation.
Definition: ConstRefVector.h:624
~ConstRefVectorConstIterator()
Definition: ConstRefVector.h:111
friend difference_type operator-(const ConstRefVectorConstIterator &i1, const ConstRefVectorConstIterator &i2)
Definition: ConstRefVector.h:206
ConstRefVector(size_type n, const ValueType &element)
See std::vector documentation.
Definition: ConstRefVector.h:655
ConstRefVectorConstIterator(const typename std::vector< ValueType *> *vec, unsigned int position)
Definition: ConstRefVector.h:93
ContainerType::size_type size_type
Definition: ConstRefVector.h:374
Iterator begin()
See std::vector documentation.
Definition: ConstRefVector.h:430
bool operator<(const ConstRefVector &array) const
Comparison of container sizes.
Definition: ConstRefVector.h:553
void sortByIntensity(bool reverse=false)
Sorting.
Definition: ConstRefVector.h:752
ConstRefVectorConstIterator & operator-=(difference_type n)
Definition: ConstRefVector.h:200
bool operator>=(const ConstRefVector &array) const
Comparison of container sizes.
Definition: ConstRefVector.h:571
ReverseComparator< Cmp > reverseComparator(Cmp const &cmp)
Make-function to create a ReverseComparator from another comparator without the need to specify the t...
Definition: ComparatorUtils.h:261
pointer operator->() const
Definition: ConstRefVector.h:228
ConstRefVector(const ConstRefVector &p)
See std::vector documentation.
Definition: ConstRefVector.h:663
ConstRefVectorConstIterator(typename std::vector< ValueType *> *vec, unsigned int position)
Definition: ConstRefVector.h:99
ConstRefVectorConstIterator & operator+=(difference_type n)
Definition: ConstRefVector.h:194
ConstRefVectorIterator< const ValueType > Iterator
Definition: ConstRefVector.h:365
ConstRefVectorIterator & operator++()
Definition: ConstRefVector.h:290
std::vector< const ValueType * > vector_
the internal vector of ValueType pointers
Definition: ConstRefVector.h:798
ValueT ValueType
Definition: ConstRefVector.h:82
friend void swap(ConstRefVector &a1, ConstRefVector &a2)
See std::vector documentation.
Definition: ConstRefVector.h:583
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
ConstReverseIterator rend() const
See std::vector documentation.
Definition: ConstRefVector.h:472
bool operator>(const ConstRefVector &array) const
Comparison of container sizes.
Definition: ConstRefVector.h:559
ConstIterator for the ConstRefVector.
Definition: ConstRefVector.h:77
size_type max_size() const
See std::vector documentation.
Definition: ConstRefVector.h:424
ConstRefVectorIterator & operator+=(typename ConstRefVectorIterator::difference_type n)
Definition: ConstRefVector.h:337
ConstRefVectorIterator & operator-=(typename ConstRefVectorIterator::difference_type n)
Definition: ConstRefVector.h:343
ConstRefVectorConstIterator & operator=(const ConstRefVectorConstIterator &rhs)
Definition: ConstRefVector.h:114
ConstRefVectorIterator & operator--()
Definition: ConstRefVector.h:303
void assign(InputIterator f, InputIterator l)
See std::vector documentation.
Definition: ConstRefVector.h:729
pointer operator->()
Definition: ConstRefVector.h:280
ReverseIterator rbegin()
See std::vector documentation.
Definition: ConstRefVector.h:454
void assign(size_type n, const ValueType &x)
See std::vector documentation.
Definition: ConstRefVector.h:736
const value_type & reference
Definition: ConstRefVector.h:85
ConstRefVectorConstIterator(const ConstRefVectorConstIterator &it)
Definition: ConstRefVector.h:105
friend void swap(ConstRefVectorIterator &i1, ConstRefVectorIterator &i2)
Definition: ConstRefVector.h:349
ConstRefVectorIterator operator-(typename ConstRefVectorIterator::difference_type n) const
Definition: ConstRefVector.h:316
ConstIterator end() const
See std::vector documentation.
Definition: ConstRefVector.h:448
bool operator!=(const ConstRefVector &array) const
See std::vector documentation.
Definition: ConstRefVector.h:547
ValueType value_type
STL-compliance type definitions.
Definition: ConstRefVector.h:373
bool empty() const
See std::vector documentation.
Definition: ConstRefVector.h:510
const_reference operator[](size_type n) const
See std::vector documentation.
Definition: ConstRefVector.h:516
ValueType value_type
Definition: ConstRefVector.h:83
ConstRefVectorConstIterator operator+(difference_type n) const
Definition: ConstRefVector.h:187
ContainerType::reference reference
Definition: ConstRefVector.h:376
const_reference back() const
See std::vector documentation.
Definition: ConstRefVector.h:498
ConstRefVectorConstIterator operator--(int)
Definition: ConstRefVector.h:173
void swap(ConstRefVector &array)
See std::vector documentation.
Definition: ConstRefVector.h:577
void clear()
See std::vector documentation.
Definition: ConstRefVector.h:504
ContainerType::difference_type difference_type
Definition: ConstRefVector.h:375
std::vector< ValueType * >::difference_type difference_type
Definition: ConstRefVector.h:84
reference operator*()
Definition: ConstRefVector.h:218
bool operator>=(const ConstRefVectorConstIterator &it) const
Definition: ConstRefVector.h:139
void pop_back()
See std::vector documentation.
Definition: ConstRefVector.h:394
ConstRefVectorConstIterator()
Definition: ConstRefVector.h:89
std::reverse_iterator< ConstIterator > ConstReverseIterator
Definition: ConstRefVector.h:368
ConstRefVector(InputIterator f, InputIterator l)
See std::vector documentation.
Definition: ConstRefVector.h:677
ConstRefVector(size_type n)
See std::vector documentation.
Definition: ConstRefVector.h:647
Mutable iterator for the ConstRefVector.
Definition: ConstRefVector.h:242
void push_back(const ValueType &x)
See std::vector documentation.
Definition: ConstRefVector.h:387
bool operator==(const ConstRefVector &array) const
See std::vector documentation.
Definition: ConstRefVector.h:522
void insert(Iterator pos, size_type n, const ValueType &element)
See std::vector documentation.
Definition: ConstRefVector.h:597
void resize(size_type new_size)
See std::vector documentation.
Definition: ConstRefVector.h:478
friend ConstRefVectorConstIterator operator+(difference_type n, const ConstRefVectorConstIterator &i)
Definition: ConstRefVector.h:211
ContainerType::value_type ValueType
Definition: ConstRefVector.h:364
size_type capacity_
the current capacity
Definition: ConstRefVector.h:800
ConstRefVectorConstIterator & operator--()
Definition: ConstRefVector.h:167
PointerComparator< Cmp > pointerComparator(Cmp const &cmp)
Make-function to create a PointerComparator from another comparator without the need to specify the t...
Definition: ComparatorUtils.h:210
const ContainerType * base_container_ptr_
Pointer to the base container.
Definition: ConstRefVector.h:802
Iterator erase(Iterator first, Iterator last)
See std::vector documentation.
Definition: ConstRefVector.h:631
bool operator>(const ConstRefVectorConstIterator &it) const
Definition: ConstRefVector.h:129
ConstRefVectorIterator(typename std::vector< ValueType *> *vec, unsigned int position)
Definition: ConstRefVector.h:261
ContainerType::const_reference const_reference
Definition: ConstRefVector.h:377
ConstRefVectorIterator operator++(int)
Definition: ConstRefVector.h:296
bool operator!=(const ConstRefVectorConstIterator &it) const
Definition: ConstRefVector.h:149
const_reference front() const
See std::vector documentation.
Definition: ConstRefVector.h:492
std::reverse_iterator< Iterator > ReverseIterator
Definition: ConstRefVector.h:367
ConstRefVectorConstIterator< const ValueType > ConstIterator
Definition: ConstRefVector.h:366
const value_type * pointer
Definition: ConstRefVector.h:86
void sortByComparator(ComparatorType const &comparator=ComparatorType())
Definition: ConstRefVector.h:786
ReverseIterator reverse_iterator
Definition: ConstRefVector.h:381
ConstRefVectorIterator operator--(int)
Definition: ConstRefVector.h:309
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
ConstRefVector(ContainerType &p)
See std::vector documentation.
Definition: ConstRefVector.h:690
std::random_access_iterator_tag iterator_category
Definition: ConstRefVector.h:87
ReverseIterator rend()
See std::vector documentation.
Definition: ConstRefVector.h:460
ConstIterator const_iterator
Definition: ConstRefVector.h:380
This vector holds pointer to the elements of another container.
Definition: ConstRefVector.h:71
~ConstRefVectorIterator()
Definition: ConstRefVector.h:271
reference operator*()
Definition: ConstRefVector.h:275
size_type size() const
See std::vector documentation.
Definition: ConstRefVector.h:400
bool operator<=(const ConstRefVectorConstIterator &it) const
Definition: ConstRefVector.h:134
void sortByPosition()
Lexicographically sorts the elements by their position.
Definition: ConstRefVector.h:765
friend ConstRefVectorIterator operator+(typename ConstRefVectorIterator::difference_type n, const ConstRefVectorIterator &i)
Definition: ConstRefVector.h:330
unsigned int position_
Definition: ConstRefVector.h:236
bool operator<(const ConstRefVectorConstIterator &it) const
Definition: ConstRefVector.h:124
ConstRefVectorIterator operator+(typename ConstRefVectorIterator::difference_type n) const
Definition: ConstRefVector.h:323
ConstIterator begin() const
See std::vector documentation.
Definition: ConstRefVector.h:442
Iterator end()
See std::vector documentation.
Definition: ConstRefVector.h:436
ConstRefVectorConstIterator & operator++()
Definition: ConstRefVector.h:154
ConstReverseIterator const_reverse_iterator
Definition: ConstRefVector.h:382
size_type capacity() const
See std::vector documentation.
Definition: ConstRefVector.h:406
ConstReverseIterator rbegin() const
See std::vector documentation.
Definition: ConstRefVector.h:466
void insert(Iterator pos, InputIterator f, InputIterator l)
See std::vector documentation.
Definition: ConstRefVector.h:611
bool operator==(const ConstRefVectorConstIterator &it) const
Definition: ConstRefVector.h:144
friend class ConstRefVector
Definition: ConstRefVector.h:79
void reserve(size_type n)
See std::vector documentation.
Definition: ConstRefVector.h:412