Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2015, 10:59:13 PM (9 years ago)
Author:
landauf
Message:

fixed issue: Class(T) may not be allowed in StaticallyInitializedIdentifier::load() because T may not yet be initialized.
now the inheritance is resolved in Identifier::finishInitialization()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/CoreIncludes.h

    r10481 r10512  
    218218    class _CoreExport StaticallyInitializedIdentifier : public StaticallyInitializedInstance
    219219    {
    220         struct InheritsFrom
     220        template <class T>
     221        struct InheritsFromClass : public Identifier::InheritsFrom
    221222        {
    222             virtual ~InheritsFrom() {}
    223             virtual Identifier* getParent() = 0;
    224         };
    225 
    226         template <class T>
    227         struct InheritsFromClass : public InheritsFrom
    228         {
    229             virtual Identifier* getParent() { return Class(T); }
     223            virtual Identifier* getParent() const { return Class(T); }
    230224        };
    231225
    232226        public:
    233227            StaticallyInitializedIdentifier(Identifier* identifier) : identifier_(identifier) {}
    234             ~StaticallyInitializedIdentifier()
    235             {
    236                 for (size_t i = 0; i < this->parents_.size(); ++i)
    237                     delete parents_[i];
    238             }
    239228
    240229            virtual void load()
    241230            {
    242231                IdentifierManager::getInstance().addIdentifier(this->identifier_);
    243                 for (size_t i = 0; i < this->parents_.size(); ++i)
    244                     this->identifier_->inheritsFrom(this->parents_[i]->getParent());
    245232            }
    246233
     
    255242            template <class T>
    256243            inline StaticallyInitializedIdentifier& inheritsFrom()
    257                 { this->parents_.push_back(new InheritsFromClass<T>()); return *this; }
     244                { this->identifier_->inheritsFrom(new InheritsFromClass<T>()); return *this; }
    258245
    259246            inline StaticallyInitializedIdentifier& virtualBase()
     
    262249        private:
    263250            Identifier* identifier_;
    264             std::vector<InheritsFrom*> parents_;
    265251    };
    266252
Note: See TracChangeset for help on using the changeset viewer.