Weird include "extras"

1
2
3
4
5
#include <iostream>

int main() {
    std::string s = "hi";
}


Why does this work? The compiler is using strings without my permission!

Also, if anyone knows, why do pointers to function members need to be fully qualified?
Last edited on
Why does this work? The compiler is using strings without my permission!
What other headers each header includes is not defined by the specification. A different compiler could reject your program.

Also, if anyone knows, why do pointers to function members need to be fully qualified?
How do you mean?
closed account (zb0S216C)
The <iostream> header includes the <string> header. So, when you use the scope resolution operator on std, string will be accessible.

Wazzak
Last edited on
Topic archived. No new replies allowed.