【C++】<bits/stdc++.h>
<bits/stdc++.h>是万能头文件。
好处:省时省力。
不足:不是GNU C++库的标准头文件,某些编译器不支持(如MSVC),不可移植;会增加编译时间,因为包含了很多不需要的内容。
下面是<bits/stdc++.h>文件的内容:
1 // C++ includes used for precompiling -*- C++ -*- 2 3 // Copyright (C) 2003-2017 Free Software Foundation, Inc. 4 // 5 // This file is part of the GNU ISO C++ Library. This library is free 6 // software; you can redistribute it and/or modify it under the 7 // terms of the GNU General Public License as published by the 8 // Free Software Foundation; either version 3, or (at your option) 9 // any later version. 10 11 // This library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 16 // Under Section 7 of GPL version 3, you are granted additional 17 // permissions described in the GCC Runtime Library Exception, version 18 // 3.1, as published by the Free Software Foundation. 19 20 // You should have received a copy of the GNU General Public License and 21 // a copy of the GCC Runtime Library Exception along with this program; 22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 // <http://www.gnu.org/licenses/>. 24 25 /** @file stdc++.h 26 * This is an implementation file for a precompiled header. 27 */ 28 29 // 17.4.1.2 Headers 30 31 // C 32 #ifndef _GLIBCXX_NO_ASSERT 33 #include <cassert> 34 #endif 35 #include <cctype> 36 #include <cerrno> 37 #include <cfloat> 38 #include <ciso646> 39 #include <climits> 40 #include <clocale> 41 #include <cmath> 42 #include <csetjmp> 43 #include <csignal> 44 #include <cstdarg> 45 #include <cstddef> 46 #include <cstdio> 47 #include <cstdlib> 48 #include <cstring> 49 #include <ctime> 50 51 #if __cplusplus >= 201103L 52 #include <ccomplex> 53 #include <cfenv> 54 #include <cinttypes> 55 #include <cstdalign> 56 #include <cstdbool> 57 #include <cstdint> 58 #include <ctgmath> 59 #include <cuchar> 60 #include <cwchar> 61 #include <cwctype> 62 #endif 63 64 // C++ 65 #include <algorithm> 66 #include <bitset> 67 #include <complex> 68 #include <deque> 69 #include <exception> 70 #include <fstream> 71 #include <functional> 72 #include <iomanip> 73 #include <ios> 74 #include <iosfwd> 75 #include <iostream> 76 #include <istream> 77 #include <iterator> 78 #include <limits> 79 #include <list> 80 #include <locale> 81 #include <map> 82 #include <memory> 83 #include <new> 84 #include <numeric> 85 #include <ostream> 86 #include <queue> 87 #include <set> 88 #include <sstream> 89 #include <stack> 90 #include <stdexcept> 91 #include <streambuf> 92 #include <string> 93 #include <typeinfo> 94 #include <utility> 95 #include <valarray> 96 #include <vector> 97 98 #if __cplusplus >= 201103L 99 #include <array> 100 #include <atomic> 101 #include <chrono> 102 #include <codecvt> 103 #include <condition_variable> 104 #include <forward_list> 105 #include <future> 106 #include <initializer_list> 107 #include <mutex> 108 #include <random> 109 #include <ratio> 110 #include <regex> 111 #include <scoped_allocator> 112 #include <system_error> 113 #include <thread> 114 #include <tuple> 115 #include <typeindex> 116 #include <type_traits> 117 #include <unordered_map> 118 #include <unordered_set> 119 #endif 120 121 #if __cplusplus >= 201402L 122 #include <shared_mutex> 123 #endif
菜鸟手记。