Weird include "extras"

Jun 1, 2011 at 1:12am
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 Jun 1, 2011 at 1:28am
Jun 1, 2011 at 2:08am
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?
Jun 1, 2011 at 11:38am
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 Jun 1, 2011 at 11:41am
Topic archived. No new replies allowed.