什么是使用value_type在STL容器?
来自MSDN:
// vector_value_type.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
int main( )
{
using namespace std;
vector<int>::value_type AnInt;
AnInt = 44;
cout << AnInt << endl;
}
Run Code Online (Sandbox Code Playgroud)
我不明白value_type这里具体实现了什么?变量也可以是一个int?是否使用是因为编码人员懒得检查向量中存在的对象类型是什么?
一旦我清楚这一点,我想我能理解allocator_type,size_type,difference_type,reference,key_type等.