C++, removing #include or #include in class header

后端 未结 12 1432
感情败类
感情败类 2021-01-03 06:37

I want to remove, if possible, the includes of both and from my class header file. Both string and vector are return types of functions declare

12条回答
  •  粉色の甜心
    2021-01-03 07:19

    There is no simple obvious way to do it (as others have explained it very well).

    However these headers should be seen as being part of the language (really!), so you can let them in your own headers without any problem, nobody will ever complain.

    If your concern is compilation speed, I encourage you to use pre-compiled header instead and put these std headers in it (among other things). It will significantly increase your compilation speed.

    Sorry the for the "real winner is the one who avoid the fight" kind of answer.

提交回复
热议问题