由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - reading STL list implementation
相关主题
构建一个快速查询字典(数据结构题)?一个 C++ STL base type 的问题
good C++ open source project?STL里面#include的问题
don't understand this list (C++ STL)auto_ptr_array.h 疑问
大家学习STL都是看SGI的文档么?请推荐本 STL 的好书
c++ stl里面有hash table吗?如何把文件内容读到2D的vector里?
一个STL的问题定义 单链表 数组,会不会很奇怪
If using C++, please avoid the use of STL for these questio (转载)请教template和factory有啥区别?
What does the default constructor do?stl: How to implement map idea with vector in stl ?
相关话题的讨论汇总
话题: stl话题: hook话题: __话题: list
进入Programming版参与讨论
1 (共1页)
r***e
发帖数: 2000
1
Can't find definition of some functions, such as _M_clear() _M_hook()
Where are they defined?
Thanks!
j********x
发帖数: 2330
2
包含的头文件?
r***e
发帖数: 2000
3

找不到踪迹。

【在 j********x 的大作中提到】
: 包含的头文件?
r*********r
发帖数: 3195
4
use grep
r***e
发帖数: 2000
5

老兄,我当然是试过了,没有找到。

【在 r*********r 的大作中提到】
: use grep
v**m
发帖数: 706
6
难道是从天而降?
r***e
发帖数: 2000
7

我怀疑和allocator有关,但是找不到。
老大,有打趣的功夫帮忙找一找?

【在 v**m 的大作中提到】
: 难道是从天而降?
r*********r
发帖数: 3195
8
start from the top level directory, use "grep -R"

【在 r***e 的大作中提到】
:
: 我怀疑和allocator有关,但是找不到。
: 老大,有打趣的功夫帮忙找一找?

r***e
发帖数: 2000
9

确实找不到:
$ grep -R _M_hook /usr/include/*
c++/4.7.2/bits/stl_list.h: _M_hook(_List_node_base* const __position) _
GLIBCXX_USE_NOEXCEPT;
c++/4.7.2/bits/stl_list.h: __tmp->_M_hook(__position._M_node);
c++/4.7.2/bits/stl_list.h: __tmp->_M_hook(__position._M_node);
c++/4.7.2/bits/list.tcc: __tmp->_M_hook(__position._M_node);
c++/4.7.2/bits/list.tcc: __tmp->_M_hook(__position._M_node);

【在 r*********r 的大作中提到】
: start from the top level directory, use "grep -R"
t****t
发帖数: 6806
10
往上看几行, 有注释:
// Supporting structures are split into common and templated
// types; the latter publicly inherits from the former in an
// effort to reduce code duplication. This results in some
// "needless" static_cast'ing later on, but it's all safe
// downcasting.
/// Common part of a node in the %list.
那意思就是说, 模板化的没办法, 必须得给你代码才能编译, 没有模板, 对性能影响又
不大的, 就给你预编译好了, 省得每次编译.
libstdc++.so, 里面就是这些代码了. 你要看源代码, 自己下载一个就可以了.

_

【在 r***e 的大作中提到】
:
: 确实找不到:
: $ grep -R _M_hook /usr/include/*
: c++/4.7.2/bits/stl_list.h: _M_hook(_List_node_base* const __position) _
: GLIBCXX_USE_NOEXCEPT;
: c++/4.7.2/bits/stl_list.h: __tmp->_M_hook(__position._M_node);
: c++/4.7.2/bits/stl_list.h: __tmp->_M_hook(__position._M_node);
: c++/4.7.2/bits/list.tcc: __tmp->_M_hook(__position._M_node);
: c++/4.7.2/bits/list.tcc: __tmp->_M_hook(__position._M_node);

r***e
发帖数: 2000
11
看到了,没有想到。
=>.>=
xiexie!

【在 t****t 的大作中提到】
: 往上看几行, 有注释:
: // Supporting structures are split into common and templated
: // types; the latter publicly inherits from the former in an
: // effort to reduce code duplication. This results in some
: // "needless" static_cast'ing later on, but it's all safe
: // downcasting.
: /// Common part of a node in the %list.
: 那意思就是说, 模板化的没办法, 必须得给你代码才能编译, 没有模板, 对性能影响又
: 不大的, 就给你预编译好了, 省得每次编译.
: libstdc++.so, 里面就是这些代码了. 你要看源代码, 自己下载一个就可以了.

r*********r
发帖数: 3195
12
the GNU libstdc++ is not the best implementation to read STL's code.
take the SGI early implementation, it's much cleaner.
i enjoyed reading every line of it.
http://www.sgi.com/tech/stl/download.html
r***e
发帖数: 2000
13

可是那是20年前的C++了,小弟平时没有机会接触实际项目,
只有看看这些库文件憧憬一下程序应该怎样写。

【在 r*********r 的大作中提到】
: the GNU libstdc++ is not the best implementation to read STL's code.
: take the SGI early implementation, it's much cleaner.
: i enjoyed reading every line of it.
: http://www.sgi.com/tech/stl/download.html

1 (共1页)
进入Programming版参与讨论
相关主题
stl: How to implement map idea with vector in stl ?c++ stl里面有hash table吗?
How is map implemented in STL?一个STL的问题
interview question: (RB tree vs. hash table)If using C++, please avoid the use of STL for these questio (转载)
AVL 和 Red Back Tree 那个比较容易implement. (转载)What does the default constructor do?
构建一个快速查询字典(数据结构题)?一个 C++ STL base type 的问题
good C++ open source project?STL里面#include的问题
don't understand this list (C++ STL)auto_ptr_array.h 疑问
大家学习STL都是看SGI的文档么?请推荐本 STL 的好书
相关话题的讨论汇总
话题: stl话题: hook话题: __话题: list