r/programming • u/meetingcpp • Apr 01 '13
Ten C++11 Features Every C++ Developer Should Use
http://www.codeproject.com/Articles/570638/Ten-Cplusplus11-Features-Every-Cplusplus-Developer
469
Upvotes
r/programming • u/meetingcpp • Apr 01 '13
12
u/wilhelmtell Apr 02 '13 edited Apr 02 '13
autois not there to save keystrokes. Occasionally it's an added bonus, sometimes you actually type more than otherwise.autois a tool to get stuff done and to avoid traps, not a mere syntactic helper.You can use
autofor return-type computation as a function of the signature.You can use
autoas a DRY tool.You can use
autoto make conversions explicit. Withoutautoconversions in initialization were implicit and there was no way for you change that unless you could change signature on the right side of an assignment. In the case of builtins -- not even then.If you don't know the type on the right side of an assignment you look it up. You don't duplicate stuff "to relief others from looking them up". You don't copy-paste entire friggin functions to relief yourself or your poor descendants from looking up code. You don't repeat function declarations on top of your code to relief your colleagues from looking up the signature.