stochastic simulation, predator/prey

Dependencies:   mbed

Revision:
0:fc1335b7b54f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Counter.h	Mon Dec 23 18:56:56 2019 +0000
@@ -0,0 +1,21 @@
+#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