Thuy Nguyen
Thuy Nguyen

Reputation: 353

reference to 'list' is ambiguous

I created a list and want to check it's size, like this

 1.  list<State> list;  
 2.  list.push_back (state1);
 3.  list.push_back (state2);
 4.  list.push_back (state2);
 5.  int l = list.size();

Then I got those error:

 "[Error] candidates are: std::list<State> list" in line 1.
 "[Error] reference to 'list' is ambiguous " in line 5.

How can I fix it?

Upvotes: 1

Views: 7393

Answers (1)

Alex
Alex

Reputation: 428

You are trying to name a variable of class list with the same name list. Give it some other name and it should be fine.

Upvotes: 3

Related Questions