-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New data structures for nodes #21
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few comments to enforce invariants and make it harder to
- use the new class wrong
- expose the relevant members, but hide others which the user should not concern himself
- avoid use of magic indices -- always give stuff a proper name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there :)
tree/node.cpp
Outdated
void PhyloNode::addLessInfoSeqs(std::string&& seq_name) | ||
{ | ||
ASSERT(!is_internal_); | ||
data_.leaf.less_info_seqs_.push_back(std::move(seq_name)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit of a duplicated interface now.
I could also write node.getLessInfoSeqs().push_back(std::move(seq_name))
Usually its bad design to allow that. Maybe keep this function and make the other const
as suggested above.
The user cannot remove elements once they are inserted. That is fine, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I prefer setting getLessInfoSeqs() as const and having addLessInfoSeqs() for users to update it
…avoid unnecessary moves
Implement new data structures (and their functions) of phylogenetic nodes