This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem porting my application to new gcc (non-const reference )


I rewrte the neccessary funtion definitions again to be clear:

static API::conf_object_t * constructor(API::parse_object_t * aParseObject) {
??????? sim_object * object = new sim_object();
??????? //Note: the reintepret cast here is safe since SimObject is POD and
??????? //conf_object comes first in SimObject.
??????? APIFwd::SIM_object_constructor(reinterpret_cast<API::conf_object 
*>(object), aParseObject);
??????? object->theObject = CppObjectClass(reinterpret_cast<API::conf_object 
*>(object));
??????? return reinterpret_cast<API::conf_object *>(object);
????? }
...

namespace aux_ {
?? API::conf_object_t * NewObject_stub(API::conf_class_t * aClass, std::string
?const & aName, API::conf_object_t * (&constructor)(API::parse_object_t *) );
?} //namespace aux_
?...

? template <class CppObjectClass >
? class Factory {
??? typedef Class<CppObjectClass> class_;
??? class_ * theClass;
???? public:
??? Factory() {
????? static class_ theStaticClass;
????? theClass = &theStaticClass;
??? }
??? typename class_::object_type create(std::string aSimName) {
????? API::conf_object_t * object = aux_::NewObject_stub(
??????? const_cast<API::conf_class_t *>( theClass->getSimClass() ), aSimName, 
theClass->constructor);
?? ....

regards,?
// Naderan *Mahmood;



----- Original Message ----
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Mahmood Naderan <nt_mahmood@yahoo.com>
Cc: gcc <gcc-help@gcc.gnu.org>
Sent: Wed, March 30, 2011 2:31:42 PM
Subject: Re: problem porting my application to new gcc (non-const reference )

On 30 March 2011 10:36, Mahmood Naderan? wrote:
>
>>Is it a static member function?
> You mean this part:
> ????? static class_ theStaticClass;
> ????? theClass = &theStaticClass;

No, I mean what is the type of theClass->constructor ?

i.e. class_::constructor


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]