A vector of lists problem.

I have a difficult problem with code...


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <vector>
#include <list>

using namespace std;

struct gram
{
    string str;
    int size;
};
list<gram> w;
vector<list<gram> >ws;

int main()
{
    list<gram> finalist;
    ws.push_back(finalist);
    return 0;
}


It is wrong, but i can't undrestund why. Compiller gcc says ...

first declared as `std::vector<std::list<gram, std::allocator<gram> >, std::allocator<std::list<gram, std::allocator<gram> > > > ws' here|

Last edited on
You got yourself into a name conflict.
using namespace std;
There is already a name 'ws' in the std namespace
( http://www.cplusplus.com/reference/iostream/manipulators/ws/ )
Either rename the ws variable, or even better: don't use using namespace std;.
Last edited on
Thank's a lot.
Topic archived. No new replies allowed.