C ++标准库的头在哪里 [英] Where are the headers of the C++ standard library

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

问题描述

我想知道在文件系统上的什么地方可以找到C ++标准库的标头.特别是我正在寻找矢量模板的定义.我在/usr/include/和各个子目录中搜索.我也尝试过"locate vector.h",它带来了许多矢量的实现,但不是标准的.我想念什么? (分布是Gentoo)

I wonder where on my file system I find the headers of the C++ Standard library. In particular I am looking for the definition of the vector template. I searched in /usr/include/ and various subdirectories. I also tried 'locate vector.h' which brought up many implementations of vectors, but not the standard one. What am I missing? (The distribution is Gentoo)

背景:我正在剖析一个在大部分时间都对vector进行迭代的库,而gprof显示大部分时间都在

Background: I'm profiling a library that iterates over vector's most of the time and gprof shows that most of the time is spent in

std::vector<int, std::allocator<int> >::_M_insert_aux(
  __gnu_cxx::__normal_iterator<int*, std::vector<
      int, std::allocator<int> > >, int const&)

可能这是在std :: vector :: push_back内部发生的,但我不确定.

Probably this is what happens internally on a std::vector::push_back, but I'm not sure.

推荐答案

GCC通常在/usr/include/c++/<version>/中安装了标准C ++标头.您可以运行gcc -v来确定已安装的版本.

GCC typically has the standard C++ headers installed in /usr/include/c++/<version>/. You can run gcc -v to find out which version you have installed.

至少在我的版本中,没有vector.h;公共标头只是vector(没有扩展名),大部分实现在bits/stl_vector.h中.

At least in my version, there is no vector.h; the public header is just vector (with no extension), and most of the implementation is in bits/stl_vector.h.

在我的Ubuntu发行版中就是这种情况;您的分配可能会有所不同.

That's the case on my Ubuntu distribution; your distribution may differ.

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

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