linear-cpp icon indicating copy to clipboard operation
linear-cpp copied to clipboard

Is #include <string> header in chapter 3 necessary?

Open joshuacook487 opened this issue 4 years ago • 1 comments

Hi,

I just finished chapter 3 and I noticed my IDE has greyed out the header - #include - suggesting that it isn't necessary. The program appears to run fine with or without it.

I can't see anywhere std::string is used in the program. Is it being used somewhere I haven't noticed and my IDE thinks it is unnecessary because the header is implicit in - #include - or is this really not needed?

If std::string is used, is it considered good practice to make headers explicit, rather than implicit in C++?

joshuacook487 avatar Nov 23 '20 16:11 joshuacook487

You're right, the include does not appear necessary; I suspect this is just a copy-paste from the previous chapter. Thanks for pointing it out!

jesyspa avatar Jan 21 '21 12:01 jesyspa