[yul-phaser] Population: Equality operators for populations and individuals

This commit is contained in:
Kamil Śliwak
2020-02-18 19:40:37 +01:00
parent d9c5e2dc9f
commit 31d8d5930a
2 changed files with 13 additions and 0 deletions
+7
View File
@@ -125,6 +125,13 @@ Population operator+(Population _a, Population _b)
return Population(_a.m_program, move(_a.m_individuals) + move(_b.m_individuals));
}
bool Population::operator==(Population const& _other) const
{
// TODO: Comparing programs is pretty heavy but it's just a stopgap. It will soon be replaced
// by a comparison of fitness metric associated with the population (once metrics are introduced).
return m_individuals == _other.m_individuals && toString(m_program) == toString(_other.m_program);
}
ostream& phaser::operator<<(ostream& _stream, Population const& _population)
{
auto individual = _population.m_individuals.begin();