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 *'
errErrList::const_iterator
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 *'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.