0

I implemented a c++ function in a template class Valli<I>. I am using the Visual C++ IDE. There is always an error on while which is:

expected a declaration

I checked the code once and once again,and didn't find out anything wrong.

template<class I>
void Valli<I>::insert(I& new_item){
    int front=0;
    int rear=links.size()-1;
    int mid=(front+rear)/2;

    //this while loop binsearches the vector<iterator>
    while(rear!=front){
        if(new_item>links[mid]*){
        front=mid;
        mid=(front+rear)/2;
        }else{
            if(new_item<links[mid]*){
            rear=mid;
            mid=(front+rear)/2;
            }else{

            rear=mid;
            front=mid;
            }
        }
    }
...
...
}
3
  • How about the "enter code here"? Mar 28, 2013 at 2:09
  • can you paste the whole compiler error from your output window? Mar 28, 2013 at 2:11
  • What is the trailing * for in the "if" statement? Mar 28, 2013 at 20:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.