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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
To: Mahmood Naderan <nt_mahmood@xxxxxxxxx>
Cc: gcc <gcc-help@xxxxxxxxxxx>
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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux