cppclean icon indicating copy to clipboard operation
cppclean copied to clipboard

Not finding operator overloading in the header file

Open arseni-mourzenko opened this issue 2 years ago • 0 comments

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?

arseni-mourzenko avatar Feb 26 '24 22:02 arseni-mourzenko