Skip to content

SFINAE constrain Algorithm::declareProperty( ... T& ... )

Gerhard Raven requested to merge sfinae-constrain-declareProperty into future
make sure that, in Algorithm,

template <T>
Property* declareProperty( const std::string& name              ,
                           T&                 property          ,
                           const std::string& doc      = "none" ) const

will not be instantiated if T derives from either GaudiHandleBase or
Gaudi::DataHandle -- as it would do the wrong thing in those cases.

There exist 'better' overloads for those cases, but in order to be
selected, they are very specific, and thus generate more code than
strictly needed. By removing this version of declareProperty from
the name resolution for those cases, the number of declareProperty
overloads can be reduced (as they can be less specific, i.e. use
a baseclass instead of a template version), and it becomes easier
to recognize the cause of certain problems (as they will be flagged
at compile time instead of exhibiting the wrong behaviour at runtime)

Merge request reports