• c++万能开头<bits/stdc++.h>


    简单介绍下C++的万能头文件

    一.开头

    当年你还不知道C++万能头代码的时候:

    1. #include
    2. #include
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include
    8. #include
    9. #include
    10. #include
    11. #include
    12. #include
    13. using namespace std;
    14. int main(){
    15. return 0;
    16. }

    当你知道了以后:

    1. #include
    2. using namespace std;
    3. int main(){
    4. return 0;
    5. }

    #include几乎包含了目前c++中所包含的所有头文件 

    二.源码

    c++&c语言:

    1. // C++ includes used for precompiling -*- C++ -*-
    2. // Copyright (C) 2003-2013 Free Software Foundation, Inc.
    3. //
    4. // This file is part of the GNU ISO C++ Library. This library is free
    5. // software; you can redistribute it and/or modify it under the
    6. // terms of the GNU General Public License as published by the
    7. // Free Software Foundation; either version 3, or (at your option)
    8. // any later version.
    9. // This library is distributed in the hope that it will be useful,
    10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12. // GNU General Public License for more details.
    13. // Under Section 7 of GPL version 3, you are granted additional
    14. // permissions described in the GCC Runtime Library Exception, version
    15. // 3.1, as published by the Free Software Foundation.
    16. // You should have received a copy of the GNU General Public License and
    17. // a copy of the GCC Runtime Library Exception along with this program;
    18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
    19. // .
    20. // 17.4.1.2 Headers
    21. // C
    22. #ifndef _GLIBCXX_NO_ASSERT
    23. #include
    24. #endif
    25. #include
    26. #include
    27. #include
    28. #include
    29. #include
    30. #include
    31. #include
    32. #include
    33. #include
    34. #include
    35. #include
    36. #include
    37. #include
    38. #include
    39. #include
    40. #if __cplusplus >= 201103L
    41. #include
    42. #include
    43. #include
    44. #include
    45. #include
    46. #include
    47. #include
    48. #include
    49. #include
    50. #endif
    51. // C++
    52. #include
    53. #include
    54. #include
    55. #include
    56. #include
    57. #include
    58. #include
    59. #include
    60. #include
    61. #include
    62. #include
    63. #include
    64. #include
    65. #include
    66. #include
    67. #include
    68. #include
    69. #include
    70. #include
    71. #include
    72. #include
    73. #include
    74. #include
    75. #include
    76. #include
    77. #include
    78. #include
    79. #include
    80. #include
    81. #include
    82. #include
    83. #include
    84. #if __cplusplus >= 201103L
    85. #include
    86. #include
    87. #include
    88. #include
    89. #include
    90. #include
    91. #include
    92. #include
    93. #include
    94. #include
    95. #include
    96. #include
    97. #include
    98. #include
    99. #include
    100. #include
    101. #include
    102. #include
    103. #include
    104. #endif

    三.使用(dev c++)

    1. #include//写到此处即可
    2. using namespace std;
    3. int main(){
    4. return 0;
    5. }

    四.优缺点

    优点如下:

        1.在竞赛中节约时间

        2.减少了编写所有必要头文件的工作量

        3.对于使用的每个函数,不用记住GNU C++的所有STL

    缺点如下:

        1.不属于GNU C++库的标准头文件,在部分情况下可能会失败

        2.使用它将包含许多不必要的东西,并增加编译时间

        3.这个头文件不是C++标准的一部分,因此是不可移植的,应该避免

        4.编译器每次编译翻译单元时都必须实际读取和分析每个包含的头文件,应该减少这类头                   文件的使用

    参考地址:https://www.cnblogs.com/blogxjc/p/11130843.html(仅为参考)

    求关注,可互关

  • 相关阅读:
    C#ref和out关键字的有什么区别?
    Ansys Zemax | 手机镜头设计 - 第 3 部分:使用 STAR 模块和 ZOS-API 进行 STOP 分析
    京东APP技术解密:移动端秒级配置触达平台-Switchquery
    微服务环境搭建
    mysql获取重复数据最新一条,并显示重复数量
    vue3编译优化之“静态提升”
    python练习题(慕课配套,三四五章)
    java计算机毕业设计网上书店进销存管理系统源程序+mysql+系统+lw文档+远程调试
    代码随想录刷题记录day34 动态规划理论基础+斐波那契数+爬楼梯+使用最小花费爬楼梯
    排序算法(1)
  • 原文地址:https://blog.csdn.net/u010583596/article/details/132642372