Skip to content

Not finding operator overloading in the header file #170

@arseni-mourzenko

Description

@arseni-mourzenko

I have a SparklineValue.h file which looks like that:

namespace visualizations {
struct SparklineValue {
    ...
    friend QDataStream &operator <<(QDataStream &s, const SparklineValue &x);
    friend QDataStream &operator >>(QDataStream &s, SparklineValue &x);
    ...
};
}

and the corresponding SparklineValue.cpp:

#include "SparklineValue.h"

namespace visualizations {
QDataStream &operator <<(QDataStream &s, const SparklineValue &x) {
    ...
    return s;
}

QDataStream &operator >>(QDataStream &s, SparklineValue &x) {
    ...
    return s;
}
}

Although the code compiles and runs correctly, cppclean complains that:

./src/visualizations/sparkline/SparklineValue.cpp:17: 'operator<<' not found in expected header './src/visualizations/sparkline/SparklineValue.h' or any other directly #included header

Shouldn't it find the operator overloading in the header file? Or am I doing it wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions