3 ms·
I have an identical complaint. Reading tutorials / books / api examples was dramatically easier before auto came on the scene. Now I have to have the header ope
by dman 11y ago
I have an identical complaint. Reading tutorials / books / api examples was dramatically easier before auto came on the scene. Now I have to have the header open on the side while I read api documentation, because most of the time I need the type information to decipher whats being written in the example.
- pmelendez 11y agoCan you share exactly why? If it is because auto as returning type, the header wouldn't be of much of a help would it? I find it easier to read now, specially when using iterators on for loops.
- dman 11y agoHeres an example -> auto now = boost::chrono::steady_clock::now().time_since_epoch(); auto timeSinceEpoch = boost::chrono::duration_cast<boost::chrono::milliseconds>(now).count(); (This is from http://stackoverflow.com/questions/16700277/get-a-double-from-boostchronosteady-clocknow http://stackoverflow.com/questions/16700277/get-a-double-fro...). The person writing the answer is dilligent and hence has supplied the types as a preamble. Most articles / answers / api docs dont take the effort to elaborate on return value types.
- Bootvis 11y agoProbably you're already aware of this but it might be useful for you or others. Item 4 of Scott Meyers' Effective Modern C++[1] shows you how to get some type information without needing to open the headers yourself. [1]: http://shop.oreilly.com/product/0636920033707.do http://shop.oreilly.com/product/0636920033707.do