operator functions

Is it possible to define an operator function for fundamental types? I'm asking because there are some operators (like ",") which don't have a use with fundamental types. For example, the following expression doesn't have any meaning:
5,3
So why not use it, let's say, for vectors? I'm quite sure it isn't, but who knows...so I'm asking.
You can overload any operator shown in the table at http://www.cplusplus.com/doc/tutorial/classes2.html for any class which doesn't already have that operator overloaded but not for built-in types
vector is a class so for that you can overload it (remember that it is a template class)
Last edited on
On the topic of operator overloading and templates, see also http://www.parashift.com/c++-faq-lite/operator-overloading.html and http://www.parashift.com/c++-faq-lite/templates.html, specificaly topic 35.16 (templates and operators as friends.
Topic archived. No new replies allowed.