Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #216 from broadinstitute/db_iterator_patch
Browse files Browse the repository at this point in the history
Fixed IndividualFieldIterator assignment operator
  • Loading branch information
MauricioCarneiro committed Aug 27, 2014
2 parents 79e213b + 30b7564 commit ae2f1c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gamgee/individual_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class IndividualField {

private:
const std::shared_ptr<bcf1_t> m_body; ///< shared ownership of the Variant record memory so it stays alive while this object is in scope
const bcf_fmt_t* const m_format_ptr; ///< pointer to m_body structure where the data for this particular type is located.
bcf_fmt_t* m_format_ptr; ///< pointer to m_body structure where the data for this particular type is located.
};


Expand Down
8 changes: 2 additions & 6 deletions gamgee/individual_field_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IndividualFieldIterator : public std::iterator<std::random_access_iterator
* @param end_iterator whether or not this is being called by the VariantField::end() function.
* @note this constructor serves only the VariantField::begin() and VariantField::end() functions.
*/
IndividualFieldIterator(const std::shared_ptr<bcf1_t>& body, const bcf_fmt_t* const format_ptr, bool end_iterator = false) :
IndividualFieldIterator(const std::shared_ptr<bcf1_t>& body, bcf_fmt_t* format_ptr, bool end_iterator = false) :
m_body {body},
m_format_ptr {format_ptr},
m_data_ptr {end_iterator ? format_ptr->p + m_format_ptr->size * m_body->n_sample : format_ptr->p}
Expand Down Expand Up @@ -69,8 +69,6 @@ class IndividualFieldIterator : public std::iterator<std::random_access_iterator
* @copydoc IndividualFieldIterator::IndividualFieldIterator(const IndividualFieldIterator&)
*/
IndividualFieldIterator& operator=(const IndividualFieldIterator& other) {
if (&this == other)
return *this;
m_body = other.m_body;
m_format_ptr = other.m_format_ptr;
m_data_ptr = other.m_data_ptr;
Expand All @@ -81,8 +79,6 @@ class IndividualFieldIterator : public std::iterator<std::random_access_iterator
* @copydoc IndividualFieldIterator::IndividualFieldIterator(IndividualFieldIterator&&)
*/
IndividualFieldIterator& operator=(IndividualFieldIterator&& other) noexcept {
if (&this == other)
return *this;
m_body = std::move(other.m_body);
m_format_ptr = other.m_format_ptr;
m_data_ptr = other.m_data_ptr;
Expand Down Expand Up @@ -228,7 +224,7 @@ class IndividualFieldIterator : public std::iterator<std::random_access_iterator

private:
std::shared_ptr<bcf1_t> m_body; ///< shared ownership of the Variant record memory so it stays alive while this object is in scope
const bcf_fmt_t* const m_format_ptr; ///< pointer to the format_field in the body so we can access the tag's information
bcf_fmt_t* m_format_ptr; ///< pointer to the format_field in the body so we can access the tag's information
uint8_t* m_data_ptr; ///< pointer to m_body structure where the data for this particular type is located.

};
Expand Down

0 comments on commit ae2f1c6

Please sign in to comment.