gnu gcc网站上的标准C ++库头文件 [英] Standard C++ libraries headers on gnu gcc site

查看:533
本文介绍了gnu gcc网站上的标准C ++库头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想浏览gnu的源代码实现C ++标准库 - 头文件以及实现。
我已经登陆:

I want to browse the source code of gnu implementation of C++ standard libraries -- header files as well as the implementation. I have landed myself into:

http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/index.html

我的第一步是查看头文件:

My first step was to look header file at:

http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/a01376.html

我的问题是,根据我的理解,typedeffed字符串sth像:
typedef basic_string string;
应该出现在字符串头中,但我在这里没有看到。

My question is that as per my understanding the typedeffed string sth like: typedef basic_string string; should have been present in string header, but I don't see one here.

问题:
--in哪个文件是定义的字符串符号?
- 我看到字符串头文件包括许多标题,如果在这些内部头文件之一中定义了类型化的sring符号,是否有一个搜索栏的东西在这个网站上,我可以达到的定义符号直行。 (如果有人已经从此网站浏览过)

Questions: --in which file is the definition of string symbol? --I see that string header file includes lot many headers and if the typedeffed sring symbol is defined in one of these internal headers, is there a search bar something on this site thru which I can reach to the definition of a symbol straightway. (in case someone has already browsed stuff from this site before)

感谢,
Jagrati

Thanks, Jagrati

推荐答案

很多libstdc ++只使用头文件,但是STL的某些部分,如 std :: basic_string

A lot of libstdc++ is implemented using only headers, but some parts of the STL, like std::basic_string, have compiled implementations.

模板 std :: basic_string 的声明位于 / usr / include / c ++ / 4.4.4 / bits / basic_string.h (用 g ++ -dumpversion 替换4.4.4 c $ c> / usr / include / c ++ / 4.4.4 / bits / basic_string.tcc 。 typedef std :: string std :: wstring 等在 ... / bits / stringfwd.h 。如果你需要使用其他模板参数来实例化 std :: basic_string ,那么你可以这样做:

The declaration of template std::basic_string is located in /usr/include/c++/4.4.4/bits/basic_string.h (replace '4.4.4' with g++ -dumpversion) and the implementation is in /usr/include/c++/4.4.4/bits/basic_string.tcc. The actual typedef of std::string, std::wstring, etc. is in .../bits/stringfwd.h. If you needed to instantiate std::basic_string with other template parameters, for example, then you do something like:

#include <bits/basic_string.tcc>

template class std::basic_string<long>;

libstdc ++实现集和映射(仅头)的方式很有趣,复杂,因为它使用自定义的红黑树实现( _Rb_tree )。

The way that libstdc++ implements sets and maps (header-only) is kind of interesting, but also very complex because it uses a custom red-black tree implementation (_Rb_tree).

libstdc ++实现 std :: vector (也是头文件)是更加自包含的,所以它值得一目了然在 / usr / include / c ++ / 4.4.4 / bits /stl_vector.h ,让你了解libstdc ++的内部。另一个有趣的文件是 ... / bits / stl_algo.h ,其中包含STL算法的定义。

The libstdc++ implementation of std::vector (also header-only) is more self-contained, so it's worth a glance in /usr/include/c++/4.4.4/bits/stl_vector.h to give you an idea of the internals of libstdc++. Another interesting file is .../bits/stl_algo.h, which contains the definitions of STL algorithms.

注意:在Windows上使用MinGW,您会在 lib\gcc\mingw32\4.4.0\include\c ++ \bits 您的MinGW安装,用 g ++ -dumpversion 替换4.4.0。

Note: On Windows with MinGW, you'll find the libstdc++ headers in lib\gcc\mingw32\4.4.0\include\c++\bits of your MinGW installation, replacing '4.4.0' with g++ -dumpversion.

这篇关于gnu gcc网站上的标准C ++库头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆