Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
6.0.0 Alpha
-
None
-
5
-
05ffeba75e90e226cd6ddf7d72cb9b9d0ad5f172 (qt/qttools/dev)
-
Da Vinci sprint 18
Description
QMap::iterator declares and implements operator== and operator!= has hidden friends in the declaration of QMap::iterator in qmap.h:
friend bool operator==(const iterator &lhs, const iterator &rhs) { return lhs.i == rhs.i; } friend bool operator!=(const iterator &lhs, const iterator &rhs) { return lhs.i != rhs.i; }
When documentation those as either member functions, or non-member functions:
/*! \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const iterator &lhs, const iterator &rhs) \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const const_iterator &lhs, const const_iterator &rhs) Returns \c true if \a lhs points to the same item as the \a rhs iterator; otherwise returns \c false. \sa operator!=() */ /*! \fn template <class Key, class T> bool operator!=(const QMap<Key, T>::iterator &lhs, const QMap<Key, T>::iterator &rhs) \fn template <class Key, class T> bool operator!=(const QMap<Key, T>::const_iterator &lhs, const QMap<Key, T>::const_iterator &rhs) Returns \c true if \a lhs points to a different item than the \a rhs iterator; otherwise returns \c false. \sa operator==() */
qdoc warns either way:
/Users/vohi/qt/dev/qtbase/src/corelib/tools/qmap.qdoc:921: (qdoc) warning: clang couldn't find function when parsing \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const iterator &lhs, const iterator &rhs) /Users/vohi/qt/dev/qtbase/src/corelib/tools/qmap.qdoc:921: (qdoc) warning: clang couldn't find function when parsing \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const const_iterator &lhs, const const_iterator &rhs) /Users/vohi/qt/dev/qtbase/src/corelib/tools/qmap.qdoc:931: (qdoc) warning: clang couldn't find function when parsing \fn template <class Key, class T> bool operator!=(const QMap<Key, T>::iterator &lhs, const QMap<Key, T>::iterator &rhs) /Users/vohi/qt/dev/qtbase/src/corelib/tools/qmap.qdoc:931: (qdoc) warning: clang couldn't find function when parsing \fn template <class Key, class T> bool operator!=(const QMap<Key, T>::const_iterator &lhs, const QMap<Key, T>::const_iterator &rhs)
In C++, a friend declared within a class generally should not be considered a member of the class. I believe this is the case for hidden friends as well, as they can be declared in the private section of a class. So, option for operator!= would be correct.
Attachments
Issue Links
- relates to
-
PYSIDE-1106 Improve the documentation toolchain
- Open