Can I define an operator overload that works with built-in / intrinsic / primitive types?
No, the C++ language requires that your operator overloads take at least one operand of a “class type” or enumeration type. The C++ language will not let you define an operator all of whose operands / parameters are of primitive types. For example, you can’t define an operator== that takes two char*s and uses string comparison.
Related Questions
- When initializing static data members of built-in / intrinsic / primitive types, should I worry about the "static initialization order fiasco"?
- When initializing non-static data members of built-in / intrinsic / primitive types, should I use the "initialization list" or assignment?
- Can I define an operator overload that works with built-in / intrinsic / primitive types?