[英]How to fix Error on expected semicolon in c++?
Can Someone help me to fix this error?有人可以帮我解决这个错误吗? It always returns the error (as mentioned in the question).
它总是返回错误(如问题中所述)。 I am beginner in c++ and any help will be appreciated.
我是 C++ 的初学者,任何帮助将不胜感激。 Thanks in Advance
提前致谢
EDIT:编辑:
THIS IS THE INCLUDES这是包括
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <iostream>
#include <iterator>
std::istringstream rows(input);
std::vector<row> data{std::istream_iterator<row>(rows),std::istream_iterator<row>()}; //the error occurs on this line
std::cout << table(data);
EDIT2:编辑2:
Code for struct table结构表的代码
struct table {
table(std::vector<row> const &r) :t(r) { }
std::vector<row> const &t;
friend std::ostream &operator<<(std::ostream &os, table const &t) {
os << "<table>";
std::copy(t.t.begin(), t.t.end(), std::ostream_iterator<row>(os));
return os << "</table>";
}
};
That should not be an initializer list, see if changing to ()
helps.那不应该是初始化列表,看看更改为
()
帮助。
std::vector<row> data(std::istream_iterator<row>(rows),std::istream_iterator<row>());
Now you are calling the constructor which takes a pair of iterators.现在您正在调用带有一对迭代器的构造函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.