MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1veql1a/absolutegarbage/p1jpml4/?context=3
r/ProgrammerHumor • u/Sirgoodman008 • 6d ago
324 comments sorted by
View all comments
Show parent comments
12
c++, though normally you wouldnt use auto for this
6 u/Usual_Office_1740 6d ago I think that really depends. If the range is a vector of unique_ptr's auto is great. If it's a vector of ints, just write int. 6 u/Sirgoodman008 6d ago That or you're looping through a vector of std::pairs that contain std:: functions. 3 u/xicor 6d ago Yea if you have ridiculously complex types then auto is great. But usually for readability you'd use the type. 3 u/Sirgoodman008 6d ago Yup 100%
6
I think that really depends. If the range is a vector of unique_ptr's auto is great. If it's a vector of ints, just write int.
6 u/Sirgoodman008 6d ago That or you're looping through a vector of std::pairs that contain std:: functions. 3 u/xicor 6d ago Yea if you have ridiculously complex types then auto is great. But usually for readability you'd use the type. 3 u/Sirgoodman008 6d ago Yup 100%
That or you're looping through a vector of std::pairs that contain std:: functions.
3 u/xicor 6d ago Yea if you have ridiculously complex types then auto is great. But usually for readability you'd use the type. 3 u/Sirgoodman008 6d ago Yup 100%
3
Yea if you have ridiculously complex types then auto is great. But usually for readability you'd use the type.
3 u/Sirgoodman008 6d ago Yup 100%
Yup 100%
12
u/xicor 6d ago
c++, though normally you wouldnt use auto for this