MantisBT - Rosetta
View Issue Details
0000305Rosetta[All Projects] Bad Codingpublic2013-09-25 13:172013-09-25 13:51
smlewis 
 
lowminoralways
newopen 
All platformsAnyAny
Trunk 
 
pose.constraint_set()
pose.constraint_set()
0000305: pose.constraint_set in NULL case
pose.constrant_set():

Pose::ConstraintSetCOP
Pose::constraint_set() const
{
    if ( constraint_set_ == 0 ) {
        return new scoring::constraints::ConstraintSet; // create an empty constraint set
    }
    return constraint_set_;
}

This has the behavior of returning a VALID pointer to an empty constraint set if the Pose has no ConstraintSet...but it doesn't set the Pose to point at that same COP! So, it returns a valid ConstraintSet that isn't actually the Pose's. Is that bad behavior?
No tags attached.
Issue History
2013-09-25 13:17smlewisNew Issue
2013-09-25 13:51smlewisNote Added: 0000316

Notes
(0000316)
smlewis   
2013-09-25 13:51   
It's because the "getter" is const, so it can't modify the
Pose::constraint_set_. The question then is, should it be nonconst?
or return NULL? or be as-is?