33 std::size_t
size() const noexcept;
51 const
Person &operator[](
std::
size_t index) const;
68 void add(
Person person,
unsigned int time) noexcept;
101 std::size_t initial_size_;
106 std::size_t next_person_id_{1};
107 std::vector<Person> people_;
109 std::vector<int> find_index_of_recyclables(
unsigned int time,
110 std::size_t top = 0) const noexcept;
114 std::
size_t allocate_next_person_id() noexcept {
115 const std::size_t
id = next_person_id_;
119 assert(
id == next_person_id_ &&
"Person ID must be the next unused value (no reuse)");
Defines the virtual population data type.
Definition population.h:19
ConstIteratorType end() const noexcept
Gets a read-only iterator to the element following the last Person of the population.
Definition population.h:90
IteratorType end() noexcept
Gets an iterator to the element following the last Person of the population.
Definition population.h:82
std::vector< Person >::iterator IteratorType
Population iterator.
Definition population.h:22
ConstIteratorType cend() const noexcept
Gets a read-only iterator to the element following the last Person of the population.
Definition population.h:98
std::size_t size() const noexcept
Gets the current size of the population.
Definition population.cpp:32
std::vector< Person >::const_iterator ConstIteratorType
Read-only population iterator.
Definition population.h:24
std::size_t initial_size() const noexcept
Gets the initial size of the population.
Definition population.cpp:34
std::size_t current_active_size() const noexcept
Gets the current active size of the population.
Definition population.cpp:36
ConstIteratorType cbegin() const noexcept
Gets an read-only iterator to the beginning of the virtual population.
Definition population.h:94
Person & at(std::size_t index)
Gets a Person by index with bounds checking.
Definition population.cpp:47
IteratorType begin() noexcept
Gets an iterator to the beginning of the virtual population.
Definition population.h:78
void add_newborn_babies(std::size_t number, core::Gender gender, unsigned int time) noexcept
Adds newborn babies of gender to the virtual population, age = 0.
Definition population.cpp:65
void add(Person person, unsigned int time) noexcept
Adds a Person to the virtual population.
Definition population.cpp:51
ConstIteratorType begin() const noexcept
Gets an read-only iterator to the beginning of the virtual population.
Definition population.h:86
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:8
Global namespace.
Definition column_iterator.h:123
Defines a virtual population person data type.
Definition person.h:39
static constexpr std::size_t unassigned_id
Sentinel returned by default constructors until Population assigns an ID.
Definition person.h:49