4 ms·
Keeping in mind that in C++, "<" would need to be an overloaded operator defined by any type used for T. That is, to those of us non-C++ programmers, there is
by Roboprog 13y ago
Keeping in mind that in C++, "<" would need to be an overloaded operator defined by any type used for T. That is, to those of us non-C++ programmers, there is a function call (callback) dependency hidden in that templated function.
Not saying it's a bad thing, just that most other languages would show something like "a.compare( b) < 0" to do something like this.
- adrianmsmith 13y agoTrue, it's hidden, but the compiler will only compile code which uses that function for types which meet that condition. So yes it's hidden, but at least you'll find out about it at compile-time, not run-time, so it could be worse.