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 | |
r***e 发帖数: 2000 | 3
找不到踪迹。
【在 j********x 的大作中提到】 : 包含的头文件?
|
r*********r 发帖数: 3195 | |
r***e 发帖数: 2000 | 5
老兄,我当然是试过了,没有找到。
【在 r*********r 的大作中提到】 : use grep
|
v**m 发帖数: 706 | |
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
|