designing a dot product operator in c++
问题 I would like to be able to write statements like a = b.c; where b and c are std::vector and a is their scalar dot product (double). For doing this, I should associate the dot product operation with '.' symbol. Is this possible? 回答1: You cannot override the dot-operator ( . ). Moreover, even if you could you never should for this purpose. When overriding operators, you should follow these three rules : If the meaning of an operator is ambigious, it should not be overloaded. Always conform to