Nerd Posts
C++: CONST CAST
Spent about 20 minutes trying to figure out why this wasn't compiling.
void CImageLoader::LoadImageL(const TDesC& filename) {
----TDesC* tmp = &filename;
// COMPILER ERROR
}
It's because filename is
CONST
. So we'll have to 'unconst' it for this line to work:
TDesC* tmp = &(const_cast
(filename));
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment