Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use reference polymorphism for Parameters to avoid initializing them in Preprocess constructors #229

Open
AmroAlJundi opened this issue Nov 2, 2022 · 0 comments
Labels
state: inactive Issue is abandoned, but might become relavent at some point type: feature Brand new functionality, features, workflows, endpoints, etc

Comments

@AmroAlJundi
Copy link
Contributor

AmroAlJundi commented Nov 2, 2022

Also regarding making the PreprocessParams params_ data member that every preprocess has a reference, there are many reasons not to do it, but the most important one is this:
A reference data member has to refer to an object that exists outside the object instance. So it doesn't contain its own object, rather a reference at an existing object.
So if I hda this class

struct C {
  int & ref_b;
  C(int &x param): ref_b(param){}
}

int main(){
  int x = 10;
  C c(x);
  x = 11; 
  cout << c.ref_b; // prints '11'
}

Plus there's this thing about reference parameters only being initializable in initiailizer list + not being able to use r-values in the parameters of the class.

@AmroAlJundi AmroAlJundi added state: inactive Issue is abandoned, but might become relavent at some point type: feature Brand new functionality, features, workflows, endpoints, etc labels Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: inactive Issue is abandoned, but might become relavent at some point type: feature Brand new functionality, features, workflows, endpoints, etc
Projects
None yet
Development

No branches or pull requests

1 participant