Question regarding polynomial class

I have several questions regarding the defined polynomial class:

http://coliru.stacked-crooked.com/a/da265451b1dca81d

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 auto instead 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 used auto instead of const Polynomial::Term& , or if i used a auto& 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.
but is it not built in "auto" to detect whether the term is reference or a instance ?
No. If you want a reference, do auto &x = y;

See here for a good explanation:
http://stackoverflow.com/questions/8797800/auto-from-const-stdvector-object-or-reference
Topic archived. No new replies allowed.