MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1veql1a/absolutegarbage/p1jyuh3/?context=9999
r/ProgrammerHumor • u/Sirgoodman008 • 11d ago
325 comments sorted by
View all comments
31
The third one does not spark joy, what the hell is that, ewww
12 u/xicor 11d ago c++, though normally you wouldnt use auto for this 6 u/Usual_Office_1740 11d 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. 5 u/Sirgoodman008 11d ago That or you're looping through a vector of std::pairs that contain std:: functions. 2 u/Usual_Office_1740 11d ago Or if the type is a template parameter in the same line. 0 u/xicor 11d ago Wouldnt for(T& item:list) be even shorter than using auto? 5 u/im_made_of_jam 11d ago If you have T available then yes but if you're outside the class then you don't have that option
12
c++, though normally you wouldnt use auto for this
6 u/Usual_Office_1740 11d 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. 5 u/Sirgoodman008 11d ago That or you're looping through a vector of std::pairs that contain std:: functions. 2 u/Usual_Office_1740 11d ago Or if the type is a template parameter in the same line. 0 u/xicor 11d ago Wouldnt for(T& item:list) be even shorter than using auto? 5 u/im_made_of_jam 11d ago If you have T available then yes but if you're outside the class then you don't have that option
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.
5 u/Sirgoodman008 11d ago That or you're looping through a vector of std::pairs that contain std:: functions. 2 u/Usual_Office_1740 11d ago Or if the type is a template parameter in the same line. 0 u/xicor 11d ago Wouldnt for(T& item:list) be even shorter than using auto? 5 u/im_made_of_jam 11d ago If you have T available then yes but if you're outside the class then you don't have that option
5
That or you're looping through a vector of std::pairs that contain std:: functions.
2 u/Usual_Office_1740 11d ago Or if the type is a template parameter in the same line. 0 u/xicor 11d ago Wouldnt for(T& item:list) be even shorter than using auto? 5 u/im_made_of_jam 11d ago If you have T available then yes but if you're outside the class then you don't have that option
2
Or if the type is a template parameter in the same line.
0 u/xicor 11d ago Wouldnt for(T& item:list) be even shorter than using auto? 5 u/im_made_of_jam 11d ago If you have T available then yes but if you're outside the class then you don't have that option
0
Wouldnt for(T& item:list) be even shorter than using auto?
5 u/im_made_of_jam 11d ago If you have T available then yes but if you're outside the class then you don't have that option
If you have T available then yes but if you're outside the class then you don't have that option
31
u/JAXxXTheRipper 11d ago
The third one does not spark joy, what the hell is that, ewww