1) Is there a significant design choice when the author choose structure instead of a class in the following program.Does it increase performance or something?
That is would it make a difference if i choose class{public: …….} instead of struct{ ………} in line number 18
2)If on line 244 i chose to use autoinstead of Polynomial::Cit it how would compiler be able to differentiate whether i used a const_iterator or just iterator
3)In line number 74 would it make a difference if i usedauto instead of const Polynomial::Term& , or if i used aauto& instead of const Polynomial::Term& .Basically how different would be auto and auto&..
Is there a significant design choice when the author choose structure instead of a class
There is no performance difference. The only difference between them is that struct members are public by default and class members are protected(?)
how would compiler be able to differentiate whether I used a const_iterator or just iterator [when using auto]
You'd have to look this up, but I'll take a guess and say that it depends on whether _terms is const.
would it make a difference if i used auto instead of [...] auto&
Yes, but the difference is in the fact that your declaring an instance rather than a reference. If you declare an instance, then you'll be creating a new Polynomial::Term each time you call that operator. As a general rule, if a parameter is larger than a simple type then you probably should pass it by reference (or const reference) instead of value
I think you may be confused about what auto does. It's just a handy way to specify the type of something. But there is absolutely no difference between declaring something with auto and declaring it with the actual type.