源码研究之高效解决如何查看万能头文件bits/stdc++.h源码的问题(DevC++版)

其实有朋友学到一定程度就想研究源码,这是不错的,下面我来简要讲一下如何找到bit/stdc++.h源码

一般源码都在安装路径下的

D:\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++

在这里插入图片描述

或者

Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\x86_64-w64-mingw32\32\bits

在这里插入图片描述

  • 接着我们就可以用记事本或者notepad++打开了
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

现在只想大喊:万能头文件,牛び!

之后我会持续更新,如果喜欢我的文章,请记得一键三连哦,点赞关注收藏,你的每一个赞每一份关注每一次收藏都将是我前进路上的无限动力 !!!↖(▔▽▔)↗感谢支持!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: bits/stdc++.h 是一个非标准的 C++ 头文件,它包含了所有标准库头文件,可以方便地使用各种 STL(标准模板库)的函数和数据结构。但是,由于它不是标准头文件,因此在一些编译器中可能无法使用。建议在编写代码时,使用标准的头文件,如 #include <iostream>、#include <vector> 等。 ### 回答2: bits/stdc++.h 是一个常用的C++头文件,它包含了大部分标准库及一些常用的第三方库。它的设计初衷是方便使用者快速编写代码,减少复杂的头文件引入。但它并不属于标准库,只是由一些C++编译器和IDE供应商提供,因此并非所有编译器和IDE都支持该头文件bits/stdc++.h 的引入可以代替包括 iostream、cstdio、cstdlib、cstring、cmath 等标准库头文件,以及 algorithm、vector、queue、stack、set 等STL相关头文件的引入,省略了大量头文件的编写。这样的做法虽然方便,但会导致编译时间变长,因为编译器需要解析整个头文件,而不是只解析需要的库。因此在一些需要优化的场合,建议使用具体的头文件,以减少编译时间。 在使用 bits/stdc++.h 的时候,需要特别注意库的命名空间。因为该头文件引入了大量的标准库和STL库,在调用库函数时不加命名空间,容易造成命名冲突。所以,使用该头文件的程序需要加上特定的命名空间,如 std::cout、std::vector 等。 总之,bits/stdc++.h 无疑给 C++ 编程带来了一定的方便,但在实际使用的时候需要注意其不足之处,如编译时间长、命名空间冲突等问题。对于不支持该头文件的编译器或需要优化编译时间的情况,还是建议使用具体的头文件。 ### 回答3: bits/stdc++.h是一个常见的C++头文件,它实际上包含了所有的标准C++头文件。从技术上讲,这个头文件不是标准的C++头文件,而是GCC编译器的头文件。GCC是一种常用的编译器,它被广泛地用于编译C++程序。 该头文件包含了来自标准库的所有头文件,包括iostream、string、vector等等,使得程序员无需一个一个地包含这些头文件就能够使用它们定义的函数和类。因此,bits/stdc++.h快速地成为了C++程序员之间的共识,方便快捷。 使用bits/stdc++.h时需要注意,若要以可移植的方式编写代码,最好只使用那些标准所定义的头文件,尤其是在大型项目中。如果仅在简单的程序中使用bits/stdc++.h是可以的,但对于复杂的场景,合理包含需要的头文件并遵循构建工具的指导,则更为可行。 总之,bits/stdc++.h这个头文件虽然不是标准C++头文件,但它提供了一种方便的方式来包含常用的头文件,加快了C++编程过程中的速度,是C++程序员常用的工具之一,但在实际应用中还是需要适量的使用和注意。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值