C2100 Illegal Indirection error?

This is a discussion on C2100 Illegal Indirection error? within the C++ Programming forums, part of the General Programming Boards category; So this is my code.. Code: vector<string> frame(const vector<string>& v){ vector<string> ret; string::size_type maxlen = width(v); string border(maxlen + 4, ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    110

    C2100 Illegal Indirection error?

    So this is my code..

    Code:
    vector<string> frame(const vector<string>& v){
    	vector<string> ret;
    	string::size_type maxlen = width(v);
    	string border(maxlen + 4, '*');
    
    	//write the top border
    	ret.push_back(border);
    
    	for(vector<string>::const_iterator i = v.begin(); i != v.end(); ++i){
    		ret.push_back("* " + *v + string(maxlen - ((*v).size()), ' ') + " *");
    	}
    
    
    	ret.push_back(border);
    	
    	return ret;
    }
    If I slightly modified this code so it would work with vector accessors, vector[i], it would work. However following my book I was asked to change it to use iterators. I did so, but now it is giving me an illegal indirection error. Ive tried debugging it with the little debugging skills I have but it didn't really help. What is this illegal indirection error?

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    You meant to say *i, not *v
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  2. file reading
    By gunghomiller in forum C++ Programming
    Replies: 9
    Last Post: 08-07-2007, 10:55 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 12:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21