implicit_cast and multiple inheritance

Ian Baxter <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
The cvs list seems dead so I'm posting here...

Implicit cast does not work with MI because it does not reset the
offset. Resetting in the main loop fixes the problem:

    int implicit_cast(
        class_rep const* crep
      , LUABIND_TYPE_INFO const& type_id
      , int& pointer_offset)
    {
        if (LUABIND_TYPE_INFO_EQUAL(crep->type(), type_id)) return 0;
		
        for (std::vector<class_rep::base_info>::const_iterator i =
            crep->bases().begin(); i != crep->bases().end(); ++i)
        {
	    int offset = 0;
            int steps = implicit_cast(i->base, type_id, offset);
            pointer_offset = offset + i->pointer_offset;
            if (steps >= 0) return steps + 2;
        }
        return -1;
    }



Cheers

Ian

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.