ubuntu 默认的是没有 c++ 库函数的 man page 的,需要我们额外安装。
方法(一):
# sudo apt-get install manpages manpages-dev manpages-posix manpages-posix-dev
# sudo apt-get install libstdc++ //按Tab键
libstdc++-4.8-dev libstdc++6-4.4-dev libstdc++6-4.7-pic
libstdc++-4.8-dev-arm64-cross libstdc++6-4.4-doc libstdc++6-4.7-pic-armel-cross
libstdc++-4.8-dev-armhf-cross libstdc++6-4.4-pic libstdc++6-4.7-pic-armhf-cross
libstdc++-4.8-dev-powerpc-cross libstdc++6-4.6-dbg libstdc++6-4.8-dbg
libstdc++-4.8-dev-ppc64el-cross libstdc++6-4.6-dev libstdc++6-4.8-dbg-arm64-cross
libstdc++-4.8-doc libstdc++6-4.6-doc libstdc++6-4.8-dbg-armhf-cross
libstdc++-4.8-pic libstdc++6-4.6-pic libstdc++6-4.8-dbg-powerpc-cross
libstdc++-4.8-pic-arm64-cross libstdc++6-4.7-dbg libstdc++6-4.8-dbg-ppc64el-cross
libstdc++-4.8-pic-armhf-cross libstdc++6-4.7-dbg-armel-cross libstdc++6-arm64-cross
libstdc++-4.8-pic-powerpc-cross libstdc++6-4.7-dbg-armhf-cross libstdc++6-armel-cross
libstdc++-4.8-pic-ppc64el-cross libstdc++6-4.7-dev libstdc++6-armhf-cross
libstdc++5 libstdc++6-4.7-dev-armel-cross libstdc++6-powerpc-cross
libstdc++6 libstdc++6-4.7-dev-armhf-cross libstdc++6-ppc64el-cross
libstdc++6-4.4-dbg libstdc++6-4.7-doc
[选择]: install libstdc++6-4.7-doc
sudo apt-get install libstdc++6-4.7-doc
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
gcc-4.7-base
下列【新】软件包将被安装:
gcc-4.7-base libstdc++6-4.7-doc
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 255 个软件包未被升级。
需要下载 20.5 MB 的软件包。
解压缩后会消耗掉 108 MB 的额外空间。
现在执行命令 man std::vector 可以看到如下效果:
std::vector< _Tp, _Alloc >(3cxx) std::vector< _Tp, _Alloc >(3cxx)
NAME
std::vector< _Tp, _Alloc > -
SYNOPSIS
Inherits std::_Vector_base< _Tp, _Alloc >.
Inherited by std::match_results< _Bi_iter > [private], and std::match_results< _FwdIterT, _Alloc >
[private].
Public Types
typedef _Alloc allocator_type
typedef
__gnu_cxx::__normal_iterator
< const_pointer, vector > const_iterator"
typedef
_Alloc_traits::const_pointer const_pointer"
typedef
_Alloc_traits::const_reference const_reference"
typedef std::reverse_iterator
< const_iterator > const_reverse_iterator"
typedef ptrdiff_t difference_type
方法(二):
GNU提供了C++的帮助文档
FTP站点: ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen//
ubuntu环境14.04,选择下载libstdc++-api.20140403.man.tar.bz2,解压(tar -jxvf libstdc++-api.20140403.man.tar.bz2)
将解压文件夹man3下的所有文件拷贝到/usr/share/man/man3/ ,注意需要root权限
man Page中查找C++函数
man 命名空间::头文件 。
通常地:man std::头文件,或man std::函数名,或man std::类名
如,查找std::cout 函数,需要现查找man std::iostream,再找到cout函数,如下所示:
std::basic_iostream< _CharT, _Traits >(3cxx) std::basic_iostream< _CharT, _Traits >(3cxx)
NAME
std::basic_iostream< _CharT, _Traits > -
SYNOPSIS
Inherits std::basic_istream< _CharT, _Traits >, and std::basic_ostream< _CharT, _Traits >.
Inherited by std::basic_fstream< _CharT, _Traits >, and std::basic_stringstream< _CharT, _Traits,
_Alloc >.
Public Types
typedef ctype< _CharT > __ctype_type
typedef ctype< _CharT > __ctype_type
typedef basic_ios< _CharT,
_Traits > __ios_type"
typedef basic_ios< _CharT,
_Traits > __ios_type"
typedef basic_istream< _CharT,
_Traits > __istream_type"
typedef num_get< _CharT,
istreambuf_iterator< _CharT,
_Traits > > __num_get_type"
使用 /cout 进行搜索