4 ms·
Yes, auto will save you: std::vector<bool> features(const Widget& w); ... auto highPriority = features(w)[5]; processWidget(w, highPriori
by jason_dstillery 12y ago
Yes, auto will save you:
std::vector<bool> features(const Widget& w);
...
auto highPriority = features(w)[5];
processWidget(w, highPriority); //whoops, undefined behavior
This is from Scott Meyers' new Effective Modern C++, in the chapter about why you should use 'auto'. Even the new 'safe' and 'convenient' features are loaded footguns.