+ 2
auto vs. auto& vs. auto&& vs. auto const &
I am pretty new to C++ and programming in general. I came across the auto keyword while learning about the different containers and how to use iterators to access each element of the container. After some research, I figured out that I could simplify the statement in the loop into auto& it : myMap compared to its much longer variant. I did some more research and found that there was also auto&& and auto const &. Can someone give a clear explanation on the difference between all four?
2 Respostas
0
I would say that here is the good explanation: https://stackoverflow.com/questions/29859796/c-auto-vs-auto
0
I am beginning to understand all but the auto&&. What is the difference between that and auto&?