CLHEP 2.4.7.1
C++ Class Library for High Energy Physics
ZMuseCount.icc
Go to the documentation of this file.
1// ----------------------------------------------------------------------
2//
3// ZMuseCount.icc - utility class for use in reference-counting
4//
5//
6// History:
7// 19-Sep-1997 WEB Design stolen, and code adapted, from pp 70-73 of
8// Koenig & Moo: "Ruminations on C++" (1996)
9// 23-Sep-1997 WEB Furnished overlooked body of copy constructor.
10//
11// ----------------------------------------------------------------------
12
13
15: p( new int(1) )
16{
17 // DEBUG if ( p == 0 )
18 // DEBUG std::cerr << "ZMuseCount memory allocation failure!" << std::endl;
19}
20
21
23: p( u.p )
24{
25 ++*p;
26}
27
28
30 if ( --*p == 0 )
31 delete p;
32}
33
34
36 return *p == 1;
37}
bool only()