1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef A_H 11 #define A_H 12 13 #include <cassert> 14 15 class A 16 { 17 int id_; 18 public: 19 explicit A(int id) : id_(id) {++count;} 20 A(const A& a) : id_(a.id_) {++count;} 21 ~A() {assert(id_ >= 0); id_ = -1; --count;} 22 23 int id() const {return id_;} 24 25 static int count; 26 }; 27 28 int A::count = 0; 29 30 #endif // A_H 31