xref: /llvm-project/libcxx/test/std/depr/depr.auto.ptr/auto.ptr/A.h (revision 851a335b1e64d0d32e15a8d2ace48c9b0967cd5a)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef A_H
10 #define A_H
11 
12 #include <cassert>
13 
14 class A
15 {
16     int id_;
17 public:
A(int id)18     explicit A(int id) : id_(id) {++count;}
A(const A & a)19     A(const A& a) : id_(a.id_) {++count;}
~A()20     ~A() {assert(id_ >= 0); id_ = -1; --count;}
21 
22     A& operator=(const A& other) { id_ = other.id_; return *this; }
23 
id()24     int id() const {return id_;}
25 
26     static int count;
27 };
28 
29 int A::count = 0;
30 
31 #endif // A_H
32