Link to home
Start Free TrialLog in
Avatar of bobbey
bobbey

asked on

const_cast error

Please let me know whats wrong with the below code snippets
errErrList::const_iterator l_iter;

errError* l_pErrObj = NULL;
errCError* l_pErrStruct = NULL;

l_pErrObj = const_cast< errError* > (l_iter);


error C2440: 'const_cast' : cannot convert from 'const errError' to 'errError *'
Avatar of pgnatyuk
pgnatyuk
Flag of Israel image

Probably you have errError (or const errError) in your container?
So something strange like l_pErrObj = &(*l_iter); (if you will remove all these const)
l_iter is an iterator. If you need the value, you use *l_iter. If your container is the vector, it is fully compatible with the standard arrays, so &(my_vector[0]) is the pointer to the first element.
ASKER CERTIFIED SOLUTION
Avatar of pgnatyuk
pgnatyuk
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial