[withdrawn] class without hash function compiles with VS 2010?

  • I noticed that a class without qHash method overload can be used without even a compiler warning in a
    @QSet<ClassWithoutHashFunction> mySet@

    Using MinGW, I get an error an cannot compile.

    What kind of magic is VS 2010 spinning here? Or is the implementation of QHash compiler-specific?

  • The Qt docs clearly say:

    [quote]QSet's value data type must be an assignable data type. You cannot, for example, store a QWidget as a value. In addition, the type must provide operator==(), and there must also be a global qHash() function that returns a hash value for an argument of the key's type.[/quote]

    Note that a pointer type should always work, regardless of what class it is pointing to. There's a generic qHash() for pointer types.

  • Ooops, my mistake.

    There was a subtle difference between the .pro files used for MinGW, and the Visual Studio Solution. Hard to spot in a big project.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.