环境是
$g++ --version
g++ (GCC) 3.4.6
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
不过应该不是它的问题
code 如下:
using namespace std;
#include <iostream>
#include <string>
int main(){
std:string a;
a = "hello world\n";
cout << a << endl;
return 0;
}
注意看是std:string 而不是std::string,
我是在我们项目中发现这个东西,应该是手误,有意思的是不仅编译通过,而且运行完全正常。
看了一下 C++的标准,没有看到这个冒号还有什么特殊的用法
哪位高手指导一下?