Request For Member 'Charname'

This is a discussion on Request For Member 'Charname' within the C++ Programming forums, part of the General Programming Boards category; Hi, I can't seem to fix this error... this is the error. All classes are VALID. request for member 'charname' ...

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    30

    Request For Member 'Charname'

    Hi, I can't seem to fix this error... this is the error. All classes are VALID.

    request for member 'charname' in '* i.__gnu_cxx::__normal_iterator<_Iterator, _Container>:perator-> [with _Iterator = game_char**, _Container = std::vector<game_char*>, __gnu_cxx::__normal_iterator<_Iterator, _Container>:ointer = game_char**]()', which is of non-class type 'game_char*'

    Code:
    int game_char::listen_ev(){
    
    	for( std::vector<game_char*>::iterator i=ev_listeners.begin(); i<ev_listeners.end();i++){
    		if(this->charname.compare(i->charname.c_str())){
    			return -1;
    		}
    	}
    	//survived return manhunt
    	ev_listeners.push_back(this);
    	return 0;
    }

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,145
    All classes are VALID.
    O_o

    Don't worry; it is just the code that is invalid.

    Well, `i' is an iterator, `*i' dereferences the iterator to yield an element, the elements are themselves pointers, and speculatively `**i' is a `game_char' type.

    Pointers are fun.

    Soma

  3. #3
    Registered User
    Join Date
    May 2011
    Posts
    30
    Ah, yes. Thanks to your help, I fixed code which now runs brilliant as small road animal in mid-summer day. Thank you, SOMA!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-16-2010, 06:27 AM
  2. Replies: 4
    Last Post: 09-04-2010, 09:12 AM
  3. Replies: 1
    Last Post: 05-18-2010, 04:14 AM
  4. Replies: 8
    Last Post: 02-15-2010, 11:08 AM
  5. Replies: 2
    Last Post: 03-17-2008, 12:21 AM

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