【发布时间】:2021-04-06 22:54:05
【问题描述】:
当迭代器被引入 ISO C++ 时,我正在寻找一个参考,我可以注意到在这个例子中它们自 C++98 以来就与向量一起使用,但我从www.isocpp.com 页面读到这不是官方的文档,但仅供参考:http://www.cplusplus.com/reference/vector/vector/vector/
// constructing vectors
#include <iostream>
#include <vector>
int main ()
{
// constructors used in the same order as described above:
std::vector<int> first; // empty vector of ints
std::vector<int> second (4,100); // four ints with value 100
std::vector<int> third (second.begin(),second.end()); // iterating through second
std::vector<int> fourth (third); // a copy of third
// the iterator constructor can also be used to construct from arrays:
int myints[] = {16,2,77,29};
std::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
std::cout << "The contents of fifth are:";
for (std::vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
return 0;
}
我也想找一个像ISO版本这样的官方文件,但是我不知道该买哪一个,从哪里买。
是否有按版本列出所有功能的页面?我一直在寻找类似的东西,但我只找到了从 C++11 开始的这个文档:https://en.cppreference.com/w/cpp/compiler_support
【问题讨论】:
-
cppreference 往往有非常具体的版本信息,这是一个很好的参考。
-
如果在isocpp.org 中没有涵盖从何处获取标准修订版的副本,他们真的错过了营销机会。
-
en.cppreference.com/w/cpp/language/history 说:
1998 C++98 (ISO/IEC 14882:1998)New features: RTTI (dynamic_cast, typeid), covariant return types, cast operators, mutable, bool, declarations in conditions, template instantiations, member templates, exportLibrary additions: locales, bitset, valarray, auto_ptr, templatized string, iostream, and complex.Based on STL: containers, algorithms, iterators, function objects -
大表回C++03 向下滚动到成员函数表 en.cppreference.com/w/cpp/container
-
感谢您的评论@tadman,我已经检查了 cppreference,它查找了迭代器和向量,它提到了 C++11 中何时引入了一些特性,但它并没有说它们是可用的C ++ 98,我假设他们这样做,因为它没有指定任何不同。最后,如果有官方文档或参考资料就好了。谢谢!
标签: c++