binary'*'instead of unary'*'or pinning pointers error

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
U238
Posts: 14
Joined: Mon Aug 17, 2009 1:01 pm
Location: Taganrog, Russia

binary'*'instead of unary'*'or pinning pointers error

Post by U238 »

Help me solve such a problem with pointers, which I can't for two days plz. I call one class method and pass it one structure argument as const reference. Then I try to use this structure member iterator on pointer on class by derefferenicng it

Code: Select all

struct SAbilityDrawParams 
{ 
   list<class CAbility *>::Iterator ab; 
   ... 
}; 
void CInterface::drawAbilityTones( const SAbilityDrawParams &params ) 
{ 
   if( (*params.ab)->selfTonesChange[t] > maxSelfToneCh ) 
   ... 
} 
but get error message

Code: Select all

C2678 binary '*' : no operator defined which takes a left-hand operand of type 'const irr::core::list<T>::Iterator' (or there is no acceptable conversion) 
though I tried use unary '*'. Manual tells that this error can "occur if you do not pin a native member before calling a member function on it".
I tried to use pin pointers but no one of two variants pass through the same error

Code: Select all

   cli::pin_ptr<const list<CAbility *>::Iterator> p = &params.ab; 
   const irr::core::list<CAbility *>::Iterator ab = *p; 
   if( (*ab)->targetTonesChange[t] < minTargToneCh )

Code: Select all

   cli::pin_ptr<const list<CAbility *>::Iterator> p = &params.ab; 
   if( (**p)->targetTonesChange[t] < minTargToneCh )
I asked this question in beginners forum but nobody answered me for the period. Will be glad if you can help me
Last edited by U238 on Tue Aug 25, 2009 5:16 am, edited 1 time in total.
U238
Posts: 14
Joined: Mon Aug 17, 2009 1:01 pm
Location: Taganrog, Russia

Post by U238 »

Problem solved simply by defining non-constant iterator on paramater member :roll:

Code: Select all

	void CInterface::drawAbilityFull( const SAbilityDrawParams &params ) 
{
	list<CAbility *>::Iterator ab = params.ab;
	if( (*ab)->selfTonesChange[t] < minSelfCh )
	...
}
Post Reply