17 template <
size_t NDEME = 1>
23 const static size_t ndeme = NDEME;
38 for (
node_it i =
I.first; i !=
I.second; i++) {
39 for (
ball_it j = (*i)->begin(); j != (*i)->end(); j++) {
51 for (
node_it i =
I.first; i !=
I.second; i++) {
52 for (
ball_it j = (*i)->begin(); j != (*i)->end(); j++) {
72 for (
size_t i = 0; i <
ndeme; i++)
79 for (
size_t i = 0; i <
ndeme; i++)
85 for (
size_t i = 0; i <
ndeme; i++) {
86 o = (
I._inven[i] >> o);
93 for (
size_t i = 0; i <
ndeme; i++) {
94 o = (o >>
I._inven[i]);
119 q = q &&
_inven[i].empty();
129 while (draw-- > 0) k++;
144 while (m <
n && k <
N) {
Balls function as pointers.
name_t deme(void) const
view deme
bool is(color_t c) const
is a given ball of the given color?
Representation for the inventory process.
inventory_t(void)=default
basic constructor for inventory class
void clean(void)
memory cleanup
size_t size(name_t i) const
size of deme
inventory_t(const inventory_t &)=default
copy constructor
inventory_t(raw_t *o)
constructor from serialized binary form
size_t bytesize(void) const
size of serialized binary form
pocket_t * random_balls(name_t i=0, int n=1) const
choose a random set of n balls from deme i
ball_t * random_ball(name_t i=0) const
choose one random ball from deme i
inventory_t(inventory_t &&)=delete
move constructor
~inventory_t(void)
destructor
inventory_t(std::pair< node_it, node_it > &&I)
static const size_t ndeme
void clear(void)
memory cleanup
bool empty(void) const
are all demes empty?
pocket_t & operator[](const name_t n)
return the n-th deme
friend raw_t * operator>>(const inventory_t &I, raw_t *o)
binary serialization
inventory_t & operator=(std::pair< node_it, node_it > &&I)
copy an inventory by iterating over a node sequence
A pocket is a set of balls.
static int random_integer(int n)
std::list< node_t * >::const_iterator node_it
std::set< ball_t *, ball_order >::const_iterator ball_it