The Diagram that showed what how the structure array is held in memory made it really click for me, thank you.
@IgnitionWeb Жыл бұрын
Also if you want to encourage values being initialized, you should do the same within the struct. either `float f = 0.f;` or just `float f{};`
@ProfessorHankStalica Жыл бұрын
Thanks for all the comments! All good ideas and I agree with you. In case you're wondering why I haven't done that so far, this channel primarily exists to support the classes I teach and so the videos I'm doing are a reflection of the textbook and SLO requirements of our department. I did do a video on std::array though (kzbin.info/www/bejne/a4bNe6WFq9F8iM0) and I am planning on doing a video on overloaded operators for structures as part of an advanced or optional series kind of deal.
@qcnck2776 Жыл бұрын
What is the benefit of using auto& rather than just auto in the range based for loop?
@ProfessorHankStalica Жыл бұрын
Here you go: kzbin.info/www/bejne/qnmwaoBsg8-LhZY It's about efficiency, copying one memory address instead of two struct members.
@qcnck2776 Жыл бұрын
@@ProfessorHankStalica Thanks 👍
@IgnitionWeb Жыл бұрын
IMO you should prefer to encourage use of std::array over c-style arrays