相关疑难解决方法(0)

什么是GCC的"vstring"?

我读了一些GCC bugreport,那里有人在谈论"vstring".搜索WEB我注意到http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.2/vstring_8h.html.

有人可以详细说明它有用和用于什么?为什么用它代替std :: string?

c++ gcc

22
推荐指数
1
解决办法
7035
查看次数

g ++是否满足std :: string C++ 11的要求

请考虑以下示例:

int main()
{
    string x = "hello";
    //copy constructor has been called here.
    string y(x);
    //c_str return const char*, but this usage is quite popular.
    char* temp = (char*)y.c_str();

    temp[0] = 'p';

    cout << "x = " << x << endl;
    cout << "y = " << y << endl;

    cin >> x;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

在visual studio编译器和g ++上运行它.当我这样做时,我得到了两个不同的结果.
用g ++:

x = pello  
y = pello
Run Code Online (Sandbox Code Playgroud)

在visual studio 2010中:

x = hello  
y = pello
Run Code Online (Sandbox Code Playgroud)

差异的原因很可能是g ++ std …

c++ string g++ std c++11

5
推荐指数
2
解决办法
2721
查看次数

标签 统计

c++ ×2

c++11 ×1

g++ ×1

gcc ×1

std ×1

string ×1