Why is there an implicit type conversion from pointers to bool in C++?

It’s very common in C to write this

void f(T* ptr) {
    if (ptr) {
        // ptr is not NULL
    }
}

You should make a const char* constructor.

Leave a Comment