MATLAB arrays support matrix operations and element operations. For example, M*N and M.*N. This is a quite intuitive way to distinguish ?the two different operations. If I want to implement similar operations in C++, how can I do that?
M*N
M.*N
Can I create a new operator, .*, too? If yes, can anyone give me some guidance?
.*
No, you can't overload op.*:
op.*
[C++03 & C++11: 13.5/3]: The following operators cannot be overloaded: . .* :: ?:
[C++03 & C++11: 13.5/3]: The following operators cannot be overloaded:
[C++03 & C++11: 13.5/3]:
. .* :: ?:
2.1m questions
2.1m answers
60 comments
57.0k users