I have already searched SO and google, I am not declaring the same variable in two places nor am I including something in a weird way..that I know of. The insert method should be working fine, it's a pre-written method(i guess that could be wrong too.. lol). This is the error I get.
Error:
error C2872: 'range_error' : ambiguous symbol
........ while compiling class template member function 'Error_code List<List_entry>::insert(int,const List_entry &)'
To me the insert method looks alright, I don't see any problems with the position variable which is being compared to 0 or count which is declared as 0 in the constructor to return the range_error.
Insert Method:
template <class List_entry>
Error_code List<List_entry>::insert(int position, const List_entry &x){
Node<List_entry> *new_node, *following, *preceding;
if(position < 0 || position > count){
return range_error;
}
if(position == 0){
if(count == 0) following = nullptr;
else {
set_position(0);
following = current;
}
preceding = nullptr;
}
else {
set_position(position - 1);
preceding = current;
following = preceding->next;
}
new_node = new Node<List_entry>(x, preceding, following);
if(new_node == nullptr) return overflow;
if(preceding != nullptr) preceding->next = new_node;
if(following != nullptr) following->back = new_node;
current = new_node;
current_position = position;
count++;
return success;
}
Could the problem be in that I don't have an implementation of the overloaded = operator?
All code here: pastie.org/1258159