J
Juha Nieminen
Hendrik said:Victor said:[...] You already can do
#define is ^
#define in Interval
...
if (4 is in (1, 10))
...
Preprocessor is not always your enemy.
Except that this wreaks havoc with code like this
std::istream& operator<<(std::istream& is, const T& o);
which isn't really uncommon.
Preprocessor macros messing up things is a relatively common problem.
For example, some versions of the C++ standard library implementation in
MSVC defined min() and max() as macros. This naturally caused havoc
anywhere you wanted to use those names, such as:
namespace
{
MyType min(MyType a, MyType b) { return ...; }
}
I once used an enumerated constant named NO_ERROR (inside a class) in
a library I made. Someone reported that this caused problems with some
version of Borland C++ because some library in that compiler defined
that name as a preprocessor macro.