|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_SEQUENCE_SEQUENCE_SET_H_
2 #define GENESIS_SEQUENCE_SEQUENCE_SET_H_
61 using iterator = std::vector<Sequence>::iterator;
83 swap( lhs.sequences_, rhs.sequences_ );
95 return sequences_.size();
103 return sequences_.empty();
108 return sequences_.at( index );
113 return sequences_.at( index );
118 return sequences_[ index ];
123 return sequences_[ index ];
135 sequences_.push_back( s );
136 return sequences_.back();
144 sequences_.push_back( std::move(s) );
145 return sequences_.back();
153 if( index >= sequences_.size() ) {
154 throw std::out_of_range(
"Index out of range for removing from SequenceSet." );
157 sequences_.erase( sequences_.begin() + index );
164 void remove(
size_t first_index,
size_t last_index )
166 if( first_index >= sequences_.size()
167 || last_index >= sequences_.size()
168 || first_index >= last_index
170 throw std::out_of_range(
"Invalid indices for removing from SequenceSet." );
173 sequences_.erase( sequences_.begin() + first_index, sequences_.begin() + last_index );
181 sequences_.erase( position );
190 sequences_.erase( first, last );
207 return sequences_.begin();
212 return sequences_.end();
217 return sequences_.cbegin();
222 return sequences_.cend();
227 return sequences_.cbegin();
232 return sequences_.cend();
241 std::vector<Sequence> sequences_;
247 #endif // include guard
void swap(Sample &lhs, Sample &rhs)
const_iterator cend() const
void remove(size_t first_index, size_t last_index)
Remove the Sequences between the first_index (inclusive) and the last_index (exclusive) from the Sequ...
void clear()
Remove all Sequences from the SequenceSet, leaving it with a size() of 0.
std::vector< Sequence >::const_iterator const_iterator
const_iterator cbegin() const
std::vector< Sequence >::iterator iterator
reference add(Sequence &&s)
Add a Sequence to the SequenceSet by moving it, and return a reference to it.
void remove(size_t index)
Remove the Sequence at a given index from the SequenceSet.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Store a set of Sequences.
const_iterator begin() const
Sequence const & const_reference
reference add(Sequence const &s)
Add a Sequence to the SequenceSet by copying it, and return a reference to it.
SequenceSet & operator=(SequenceSet const &)=default
const_reference at(size_t index) const
void remove(iterator position)
Remove the Sequence at a given iterator position from the SequenceSet.
reference at(size_t index)
const_iterator end() const
friend void swap(SequenceSet &lhs, SequenceSet &rhs)
void remove(iterator first, iterator last)
Remove the Sequences between the first (inclusive) and the last (exclusive) iterator position from th...
reference operator[](size_t index)