Skip to content

Commit

Permalink
Explain curious operator==
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytheway committed Dec 22, 2019
1 parent b196175 commit 853b4b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/stomach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ bool nutrients::operator==( const nutrients &r ) const
if( kcal != r.kcal ) {
return false;
}
// Can't just use vitamins == r.vitamins, because there might be zero
// entries in the map, which need to compare equal to missing entries.
for( const std::pair<const vitamin_id, vitamin> &vit_pair : vitamin::all() ) {
const vitamin_id &vit = vit_pair.first;
if( get_vitamin( vit ) != r.get_vitamin( vit ) ) {
Expand Down

0 comments on commit 853b4b4

Please sign in to comment.