stochastic simulation, predator/prey

Dependencies:   mbed

Counter.h

Committer:
manitou
Date:
2019-12-23
Revision:
0:fc1335b7b54f

File content as of revision 0:fc1335b7b54f:

#ifndef MYCOUNTER
#define MYCOUNTER
template <typename T>
struct counter
{
    counter()
    {
        objects_created++;
        objects_alive++;
    }

    virtual ~counter()
    {
        --objects_alive;
    }
    static int objects_created;
    static int objects_alive;
};
template <typename T> int counter<T>::objects_created( 0 );
template <typename T> int counter<T>::objects_alive( 0 );
#endif