Skip to content

Commit

Permalink
Add Diversity Processor Calculator iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
lczech committed May 29, 2024
1 parent 69a4531 commit 7240f36
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/genesis/population/function/diversity_pool_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,20 @@ class DiversityPoolProcessor
return calculators_;
}

// -------------------------------------------------------------------------
// Calculator Iterator
// -------------------------------------------------------------------------

std::vector<DiversityPoolCalculator>::iterator begin()
{
return calculators_.begin();
}

std::vector<DiversityPoolCalculator>::iterator end()
{
return calculators_.end();
}

// -------------------------------------------------------------------------
// Internal Members
// -------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions test/src/population/diversity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,11 @@ void test_diversity_fuzzy_run_( std::vector<Variant> const& data )
window_average_policy, settings, pool_sizes
);

// Set some settings, to test the iterator
for( auto& calc : processor ) {
calc.enable_tajima_d( true );
}

// Run the data
for( auto const& variant : data ) {
processor.process( variant );
Expand Down

0 comments on commit 7240f36

Please sign in to comment.