Operating System - HP-UX
1752794 Members
6450 Online
108789 Solutions
New Discussion юеВ

Probelm with const_cast in aCC6

 
Samir Benjamin
Occasional Advisor

Probelm with const_cast in aCC6

How to overcome this error?

RCSIResponseToXml.cpp", line 369: error #2717: the type in a const_cast must
be a pointer, reference, or pointer to member to an object type
XmlTagEmit ("POBox", const_cast(billInfo->getbillingNameAndAddress()).getROUTEBOX(), xml);
^
2 REPLIES 2
kobylka
Valued Contributor

Re: Probelm with const_cast in aCC6

Hi!

If BillingNameAndAddress is the class, try:

XmlTagEmit ("POBox", const_cast(billInfo->getbillingNameAndAddress()).getROUTEBOX(), xml);

Note the ``&'' following immediately the class name.

Regards,

Kobylka

Dennis Handly
Acclaimed Contributor

Re: Problem with const_cast in aCC6

Why would you need to const_cast the result of a function call? Functions don't return "const" things. They could return pointers or references to them.

It would be helpful if you can provide the signature of getROUTEBOX().