Results 1 to 5 of 5

Thread: operator<

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default operator<

    how do I write that for a class X?
    I'm gonna use qSort.
    Qt Code:
    1. bool X::operator<(const X& a)
    2. {
    3. return number < a.number;}
    To copy to clipboard, switch view to plain text mode 
    don't work.

    /usr/include/qt4/QtCore/qalgorithms.h:118: error: passing `const X' as
    `this' argument of `bool X:perator<(const X&)' discards
    qualifiers
    Last edited by Morea; 10th May 2006 at 00:23.

Similar Threads

  1. How to implement operator<() for QMap
    By learning_qt in forum Qt Programming
    Replies: 6
    Last Post: 9th January 2009, 10:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.