mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 00:41:23 +00:00
domtreeviewer: Fix build with clang.
DOM::Node does not originally have operator<(DOM::Node, DOM::Node) implemented in khtml, so domtreecommands.cpp implemented it. However, it did so in the `domtreeviewer' namespace. When ManipulationCommand::addChangedNode() is called, it calls ChangedNodeSet::insert(), which is actually QMap<DOM::Node, bool>::insert(), which calls qMapLessThanKey(), which finally calls operator<(). Since QMap is not part of the `domtreeviewer' namespace, when qMapLessThanKey() calls operator<(), it never looks for an implementation in the `domtreeviewer' namespace. Argument-dependend name lookup makes the compiler look for an implementation in the namespace of the function arguments (DOM, in this case), so we need to move our implementation there. For some reason, the code built fine with gcc. Thanks to Nicolás Alvarez for the initial discussion, and [1] for the ugly details. [1] http://www.gotw.ca/publications/mill08.htm
This commit is contained in:
parent
89b45001d2
commit
c3e23ca299
|
@ -79,14 +79,18 @@ ManipulationCommandSignalEmitter* ManipulationCommand::mcse()
|
|||
|
||||
// == ChangedNodeSet ================================================
|
||||
|
||||
namespace domtreeviewer {
|
||||
namespace DOM {
|
||||
|
||||
// collection of nodes for which to emit the nodeChanged signal
|
||||
inline static bool operator <(const DOM::Node &n1, const DOM::Node &n2)
|
||||
{
|
||||
return (qptrdiff)n1.handle() - (qptrdiff)n2.handle() < 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace domtreeviewer {
|
||||
|
||||
// collection of nodes for which to emit the nodeChanged signal
|
||||
class ChangedNodeSet : public QMap<DOM::Node, bool>
|
||||
{
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue