/usr/include/CLHEP/RefCount/ZMhandleTo.icc is in libclhep-dev 2.1.4.1+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | // ----------------------------------------------------------------------
//
// ZMhandleTo.icc - generic handle class for objects that need to be
// reference-counted
//
// History:
// 19-Sep-1997 WEB Design stolen, and code adapted, from
// Stroustrup: "The C++ Programming Language, 3rd ed" (1997), p 783
// Koenig & Moo: "Ruminations on C++" (1996), ch 7
// 22-Sep-1997 WEB Updated to require (& use) clone() operator
// for reference-counted objects; this is to insure against a user's
// destroying the object while one or more handles are still pointing
// to it
//
// ----------------------------------------------------------------------
template< class T>
inline ZMhandleTo<T>::ZMhandleTo()
: u_()
, rep_( new T )
{ ; }
template< class T>
inline ZMhandleTo<T>::ZMhandleTo( const ZMhandleTo<T> & h )
: u_ ( h.u_ )
, rep_( h.rep_ )
{ ; } // copy constructor, share the representation
template< class T>
inline ZMhandleTo<T>::~ZMhandleTo() {
if ( u_.only() )
delete rep_;
} // destructor
template< class T>
inline ZMhandleTo<T> & ZMhandleTo<T>::operator=( const ZMhandleTo<T> & rhs ) {
if ( u_.reattach( rhs.u_) )
delete rep_;
rep_ = rhs.rep_;
return *this;
} // operator=()
template< class T>
inline ZMhandleTo<T>::ZMhandleTo( const T & t )
: rep_( t.clone() )
{ ; }
template< class T>
inline ZMhandleTo<T>::ZMhandleTo( const T * t )
: rep_( t->clone() )
{ ; }
|