fix(nbhood): make accessors const

This commit is contained in:
Johann Dreo 2024-09-10 16:47:28 +02:00 committed by nojhan
commit b96b537ed1
2 changed files with 4 additions and 4 deletions

View file

@ -62,7 +62,7 @@ class moBinaryPartition : public EO<FitT>
* You are responsible for making it consistent after instantiation.
*
* @warning If you do not fill at least the @ref rejected set,
* errors will be raised whe trying to @ref select or @ref reject.
* errors will be raised when trying to @ref select or @ref reject.
*/
moBinaryPartition()
{ }
@ -127,7 +127,7 @@ class moBinaryPartition : public EO<FitT>
std::ostream_iterator<AtomType>(out, " ")); // Values.
}
//! Convenience function to only render the fitess and the selected atoms (and not the rejected ones).
//! Convenience function to only render the fitness and the selected atoms (and not the rejected ones).
std::string str() const
{
std::ostringstream msg;

View file

@ -31,7 +31,7 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood<moBinaryPartitio
using AtomType = typename EOT::AtomType;
/** Get the currently pointed selected atom. */
AtomType selected(EOT& from, const size_t i_select) {
AtomType selected(EOT& from, const size_t i_select) const {
typename EOT::ContainerType::iterator
it = std::begin(from.rejected);
std::advance(it, i_select);
@ -39,7 +39,7 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood<moBinaryPartitio
}
/** Get the currently pointed rejected atom. */
AtomType rejected(EOT& from, const size_t j_reject) {
AtomType rejected(EOT& from, const size_t j_reject) const {
typename EOT::ContainerType::iterator
it = std::begin(from.selected);
std::advance(it, j_reject);