在unbutu上通过man查看C++标准函数库

在职业生涯初期养成的习惯,所有不清楚的函数用法都问下度娘或者google。除了常用的unix系统的标准函数是通过man进行查询,很少使用man函数去查询标准函数库的函数。今天不知为什么心血来潮,很长一段时间也没有写过C++的代码了(最近几个月都是做着数据分析,都是使用python),今天突然想用C++实现一个功能,于是动手去写,发现很多函数自己都忘记原型了。一个个去问google,想了想,能不能不来回切换,直接在系统上能查得到就好了,问了google和度娘,资料不多的,但这个想法还是很容易达成的。安装步骤如下:

安装依赖包:

linxiaojie1@deeplearn39:~/workspace/alg$  sudo apt-get install manpages manpages-dev manpages-posix manpages-posix-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
manpages is already the newest version (4.04-2).
manpages-dev is already the newest version (4.04-2).
manpages-dev set to manually installed.
The following NEW packages will be installed:
  manpages-posix manpages-posix-dev
0 upgraded, 2 newly installed, 0 to remove and 413 not upgraded.
Need to get 2,726 kB of archives.
After this operation, 3,299 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.yy.duowan.com:63782/ubuntu xenial/multiverse amd64 manpages-posix all 2013a-1 [929 kB]
Get:2 http://mirror.yy.duowan.com:63782/ubuntu xenial/multiverse amd64 manpages-posix-dev all 2013a-1 [1,797 kB]
Fetched 2,726 kB in 0s (4,650 kB/s)       
Selecting previously unselected package manpages-posix.
(Reading database ... 112593 files and directories currently installed.)
Preparing to unpack .../manpages-posix_2013a-1_all.deb ...
Unpacking manpages-posix (2013a-1) ...
Selecting previously unselected package manpages-posix-dev.
Preparing to unpack .../manpages-posix-dev_2013a-1_all.deb ...
Unpacking manpages-posix-dev (2013a-1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up manpages-posix (2013a-1) ...
Setting up manpages-posix-dev (2013a-1) ...

安装C++标准文档库:

linxiaojie1@deeplearn39:~/workspace/alg$ sudo apt-get install libstdc++6-4.7-doc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  gcc-4.7-base
The following NEW packages will be installed:
  gcc-4.7-base libstdc++6-4.7-doc
0 upgraded, 2 newly installed, 0 to remove and 413 not upgraded.
Need to get 14.8 MB of archives.
After this operation, 86.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.yy.duowan.com:63782/ubuntu xenial/universe amd64 gcc-4.7-base amd64 4.7.4-3ubuntu12 [14.0 kB]
Get:2 http://mirror.yy.duowan.com:63782/ubuntu xenial/universe amd64 libstdc++6-4.7-doc all 4.7.4-3ubuntu12 [14.8 MB]
Fetched 14.8 MB in 1s (9,907 kB/s)             
Selecting previously unselected package gcc-4.7-base:amd64.
(Reading database ... 113741 files and directories currently installed.)
Preparing to unpack .../gcc-4.7-base_4.7.4-3ubuntu12_amd64.deb ...
Unpacking gcc-4.7-base:amd64 (4.7.4-3ubuntu12) ...
Selecting previously unselected package libstdc++6-4.7-doc.
Preparing to unpack .../libstdc++6-4.7-doc_4.7.4-3ubuntu12_all.deb ...
Unpacking libstdc++6-4.7-doc (4.7.4-3ubuntu12) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up gcc-4.7-base:amd64 (4.7.4-3ubuntu12) ...
Setting up libstdc++6-4.7-doc (4.7.4-3ubuntu12) ...

接下来就可以查询到标准库相关的函数了

linxiaojie1@deeplearn39:~/workspace/alg$ man std::map
std::map< _Key, _Tp, _Compare, _Alloc >(3cxx)                                                                std::map< _Key, _Tp, _Compare, _Alloc >(3cxx)

NAME
       std::map< _Key, _Tp, _Compare, _Alloc > -

SYNOPSIS
   Public Types
       typedef _Alloc allocator_type
       typedef _Rep_type::const_iterator const_iterator
       typedef _Pair_alloc_type::const_pointer const_pointer
       typedef _Pair_alloc_type::const_reference const_reference
       typedef _Rep_type::const_reverse_iterator const_reverse_iterator
       typedef _Rep_type::difference_type difference_type
       typedef _Rep_type::iterator iterator
       typedef _Compare key_compare
       typedef _Key key_type
       typedef _Tp mapped_type
       typedef _Pair_alloc_type::pointer pointer
       typedef _Pair_alloc_type::reference reference
       typedef _Rep_type::reverse_iterator reverse_iterator
       typedef _Rep_type::size_type size_type
       typedef std::pair< const _Key, _Tp > value_type

   Public Member Functions
       map ()
       map (const _Compare &__comp, const allocator_type &__a=allocator_type())
       map (const map &__x)
       map (map &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)

大功告成,留下脚印。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值