为什么会是vector>?
cure 2002-05-20 09:31:19 在编译到 cout << current_vec[ 0 ] << endl 时出现错误:
"operator<<" not implemented in type "ostream" for arguments of type "vector<int,allocator<int>>"
我的current_vec此时到底是什么?
//初始化两个VECTOR
vector<int> fibonacci( 3 ), lucas( 3 );
fibonacci[ 0 ] = 1;
fibonacci[ 1 ] = 1;
fibonacci[ 2 ] = 2;
lucas[ 0 ] = 1;
lucas[ 1 ] = 3;
lucas[ 2 ] = 4;
//定义一个VECTOR类型的指针数组
vector<int> *seq_addrs[ 2 ] = { &fibonacci, &lucas};
//初始化current_vec
vector<int> *current_vec = 0;
//给 current_vec附值
int seq_index = 1;
current_vec = seq_addrs[ seq_index ];
我这时的current_vec是不是应该指向fibonacci,属于vector<int>类型?即
current_vec[ 0 ] == 1;
current_vec[ 1 ] == 1;
current_vec[ 2 ] == 2;
可从编译(我用的是c++ builder 6.0)的几处报错来看显然不是的。为什么呢?那我的current_vec这时又是什么呢?
vector<int,allocator<int>>又是什么东西呀?
谢谢大家指教!