hepmc - Diff between revs 111 and 128

Subversion Repositories:
Rev:
Show entire file - Ignore whitespace
Rev 111 Rev 128
Line 56... Line 56...
56     GenParticle& GenParticle::operator=( const GenParticle& inparticle ) { 56     GenParticle& GenParticle::operator=( const GenParticle& inparticle ) {
57         /// Shallow: does not copy the vertex pointers 57         /// Shallow: does not copy the vertex pointers
58         /// (note - impossible to copy vertex pointers which having the vertex 58         /// (note - impossible to copy vertex pointers which having the vertex
59         ///         and particles in/out point-back to one another -- unless you 59         ///         and particles in/out point-back to one another -- unless you
60         ///         copy the entire tree -- which we don't want to do) 60         ///         copy the entire tree -- which we don't want to do)
61         set_momentum( inparticle.momentum() ); -  
62         set_pdg_id( inparticle.pdg_id() ); -  
63         set_status( inparticle.status() ); -  
64         set_production_vertex_( 0 ); -  
65         set_end_vertex_( 0 ); -  
66         set_flow(inparticle.m_flow); -  
67         set_polarization( inparticle.polarization() ); -  
68         suggest_barcode( inparticle.barcode() ); -  
69         set_generated_mass( inparticle.generated_mass() ); -  
-   61         // Protect against self assignment
-   62         // This works, but is not best practices
-   63         // Best practices involves a rewrite to use the copy constructor and swap
-   64         if( this != &inparticle ) {
-   65             set_momentum( inparticle.momentum() );
-   66             set_pdg_id( inparticle.pdg_id() );
-   67             set_status( inparticle.status() );
-   68             set_production_vertex_( 0 );
-   69             set_end_vertex_( 0 );
-   70             set_flow(inparticle.m_flow);
-   71             set_polarization( inparticle.polarization() );
-   72             suggest_barcode( inparticle.barcode() );
-   73             set_generated_mass( inparticle.generated_mass() );
-   74         }
70         return *this; 75         return *this;
71     } 76     }
72 77
73     bool GenParticle::operator==( const GenParticle& a ) const { 78     bool GenParticle::operator==( const GenParticle& a ) const {
74         /// consistent with the definition of the copy constructor as a shallow 79         /// consistent with the definition of the copy constructor as a shallow