对于下面的代码,为什么会出错? ostream_iterator是一个模板类,为什么没有匹配的构造函数来初始化它?为什么我可以使用ostream_interator但不使用ostream_iterator
define ostream_iterator template > class _LIBCPP_VISIBLE ostream_iterator
int main(int argc, const char * argv[])
{
vector<int> sentence1;
sentence1.reserve(5);// 设置每次分配内存的大小
sentence1.push_back(1);
sentence1.push_back(2);
sentence1.push_back(3);
sentence1.push_back(4);
sentence1.push_back(5);
int c = 5;
copy(sentence1.begin(), sentence1.end(), ostream_iterator<int, int>(cout, &c));
cout << endl;