why does __null, 0, 0.0 work but (void *)0,nullptr dont work when assignment overload is used
Take for example
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/types_c.h>
#include<iostream>
using namespace cv;
int main(int argc, char** argv) {
Mat frame;
frame = (void *)0;
Mat frame2;
frame2 = nullptr;
return 0;
}
the above throws overload errors
/home/shft/build/test/hello.cpp:9:10: error: no viable overloaded '='
frame = (void *)0;
~~~~~ ^ ~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/mat.hpp:1073:10: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'const cv::Mat' for 1st argument
Mat& operator = (const Mat& m);
^
/usr/local/include/opencv4/opencv2/core/mat.inl.hpp:3008:11: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'const cv::MatExpr' for 1st argument
Mat& Mat::operator = (const MatExpr& e)
^
/usr/local/include/opencv4/opencv2/core/mat.hpp:1260:10: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'const cv::Scalar' (aka 'const Scalar_<double>') for 1st argument
Mat& operator = (const Scalar& s);
^
/usr/local/include/opencv4/opencv2/core/mat.hpp:2101:10: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'cv::Mat' for 1st argument
Mat& operator = (Mat&& m);
^
/home/shft/build/test/hello.cpp:11:11: error: no viable overloaded '='
frame2 = nullptr;
~~~~~~ ^ ~~~~~~~
/usr/local/include/opencv4/opencv2/core/mat.hpp:1073:10: note: candidate function not viable: no known conversion from 'std::nullptr_t' to 'const cv::Mat' for 1st argument
Mat& operator = (const Mat& m);
^
/usr/local/include/opencv4/opencv2/core/mat.inl.hpp:3008:11: note: candidate function not viable: no known conversion from 'std::nullptr_t' to 'const cv::MatExpr' for 1st argument
Mat& Mat::operator = (const MatExpr& e)
^
/usr/local/include/opencv4/opencv2/core/mat.hpp:1260:10: note: candidate function not viable: no known conversion from 'std::nullptr_t' to 'const cv::Scalar' (aka 'const Scalar_<double>') for 1st argument
Mat& operator = (const Scalar& s);
^
/usr/local/include/opencv4/opencv2/core/mat.hpp:2101:10: note: candidate function not viable: no known conversion from 'std::nullptr_t' to 'cv::Mat' for 1st argument
Mat& operator = (Mat&& m);
But __null or any integer literal work (on my system NULL is defined as nullptr as a macro definition