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 list" in line 1. "[Error] reference to 'list' is ambiguous " in line 5.
How can I fix it?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.