N
N
nadom2015-03-01 19:22:32
Programming
nadom, 2015-03-01 19:22:32

Is it possible to overload base types in C++?

Is it possible to implement base type overloading in C++?
For example overload the comparison operators < > == for char/char*.
I need this in order to conveniently work with a template tree, and not remake it under char*.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MiiNiPaa, 2015-03-01
@nadom

No. In your case, you can write your own comparator and pass it as a template parameter to your tree.
If it doesn't support custom comparators, add support, it's very useful.

T
tsarevfs, 2015-03-01
@tsarevfs

This is definitely a bad idea. If you want to conveniently compare strings, use std::string.

A
AxisPod, 2015-03-02
@AxisPod

You can overload it, but what will come of it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question