I've got a project I've been wrestling with for a while, which is almost ready for submission; but there have been a few previous coders who have contributed. Their code is great, but it doesn't satisfy the lint for the project this class is going to be submitted to; so, I'm spending some time cleaning it up.
One of the things this project forbids is the auto keyword. This is understandable, as a lot of people contribute to it, and they aren't all the most experienced so much as enthusiastic; so being explicit is a good thing.
There are quite a few autos in here. I remember that g++ -E would give me a file after the preprocessor was run, and it occurs to me that there's probably a way to do something similar with type specifiers.
Failing that, I'm using Qt Creator on a Linux box, which might also have a feature (kind of like "replace symbol under cursor") which I don't know about yet.
Is there anything that will allow me to automatically replace auto with its deduced type name, in a C++ file?
No, this is not possible in general, for multiple reasons.
Firstly, there are cases where
autorefers to unnamed types, such as closure types of lambdas, etc.But even if you always had a usable type, how exactly should it be formatted?
Knowing which type to display to the user is an extremely difficult problem in C++. IDEs often have special cases to deal with this. For example, CLion may display
std::basic_string<char>asstring, but this is not an automated transformation.