怎么区别string的capacity和size
#include <iostream>
#include <string>
using namespace std;
int main()
{
string st1("This is a test!");
cout<<st1.capacity()<<endl;
cout<<st1.size()<<endl;
return 0;
}
上面这个程序在VC6.0下得到结果是31和15,但是在linux下得到结果却是15和15,这个是什么原因产生的,是编译器的原因么,还是别的什么原因。这两个函数的区别在哪,请各位大侠帮忙