Refactoring #1748

Consider IParameter storing the data by reference

Added by pospelov over 3 years ago. Updated almost 3 years ago.

Status:RejectedStart date:18 Jan 2017
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Suggestion: instead of

template<typename T>
IParameter {
    IParameter(string name, T* data)
   T* m_data;
}

use the reference

template<typename T>
IParameter {
    IParameter(string name, T& data)
   T& m_data;
}
Reasoning
  • Few lines code less in RealParameter
    • No need to check if pointer != nullptr, and to provide machinery for pointing RealParameter to another source.
  • It is one character less to type while registering parameters: registerParameter(m_width) instead of registerParameter(&m_width)

From another hand, lots of files will be changed, without no strong reason.

Another thing to have in mind: for the moment RealParameter doesn't provide any defense against parent IParameterized being deleted. Shall we think of such defense?

History

#1 Updated by pospelov almost 3 years ago

  • Status changed from Rfc to Rejected

Also available in: Atom PDF