IndexedType of ctors / Overriding ctors

Andreas Pakulat apaku at gmx.de
Thu Aug 12 19:02:39 UTC 2010


On 12.08.10 19:49:47, Milian Wolff wrote:
> On Monday, 9. August 2010 14:47:06 David Nolden wrote:
> > 2010/8/9 Milian Wolff <mail at milianw.de>:
> > > Hello all, esp. David :)
> > > 
> > > I noticed that the OverrideHelper only offers you one Ctor at a time,
> > > since it uses a Hash with IndexedType as key, and apparently that is
> > > equal for all Ctors. I want to fix that, what would you propose?
> > 
> > Hmm, the type should be different, after all it contains all the
> > function parameters. So that's probably the problem here. If you want
> > to fix it, make sure  that the argument-types are correctly stored in
> > the function-type of a constructur.
> > constructor->abstractType()->toString() should show the argument
> > types.
> 
> The reason was that QMap was used and IndexedType did not provide an 
> implementation of operator<().
> 
> I wonder how it could compile without that implementation...

IndexedType has a operator bool() const and bool is comparable with operator<:

#include <stdio.h>
class Foo {
public:
    operator int() { return -1; }
    operator int() const { return -1; }
};

int main()
{

    Foo f1,f2;

    if( f1 < f2 ) {
        fprintf(stderr, "smaller\n");
    } else {
        fprintf(stderr, "bigger\n");
    }
}

Andreas

-- 
Your heart is pure, and your mind clear, and your soul devout.




More information about the KDevelop-devel mailing list