1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef TEST_CLASS_DWA2002326_HPP
6 # define TEST_CLASS_DWA2002326_HPP
7 # include <boost/assert.hpp>
8 
9 template <int n = 0>
10 struct test_class
11 {
test_classtest_class12     explicit test_class(int x) : x(x), magic(7654321 + n) { ++counter; }
test_classtest_class13     test_class(test_class const& rhs) : x(rhs.x), magic(7654321 + n) { ++counter; }
~test_classtest_class14     virtual ~test_class() { BOOST_ASSERT(magic == 7654321 + n); magic = 6666666; x = 9999; --counter; }
15 
settest_class16     void set(int _x) { BOOST_ASSERT(magic == 7654321 + n); this->x = _x; }
valuetest_class17     int value() const { BOOST_ASSERT(magic == 7654321 + n); return x; }
operator inttest_class18     operator int() const { return x; }
counttest_class19     static int count() { return counter; }
20 
21     int x;
22     long magic;
23     static int counter;
24 
25  private:
26     void operator=(test_class const&);
27 };
28 
29 template <int n>
30 int test_class<n>::counter;
31 
32 #endif // TEST_CLASS_DWA2002326_HPP
33