Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/python/test/test_class.hpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 984 bytes
Line 
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 <cassert>
8
9template <int n = 0>
10struct test_class
11{
12    explicit test_class(int x) : x(x), magic(7654321 + n) { ++counter; }
13    test_class(test_class const& rhs) : x(rhs.x), magic(7654321 + n) { ++counter; }
14    virtual ~test_class() { assert(magic == 7654321 + n); magic = 6666666; x = 9999; --counter; }
15
16    void set(int x) { assert(magic == 7654321 + n); this->x = x; }
17    int value() const { assert(magic == 7654321 + n); return x; }
18    operator int() const { return x; }
19    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
29template <int n>
30int test_class<n>::counter;
31
32#endif // TEST_CLASS_DWA2002326_HPP
Note: See TracBrowser for help on using the repository browser.