using namespace std;
int main() {
const char * values[] = { "first", "second", "third", "fourth" };
StrSeq myseq; // Create empty sequence
// Create four empty strings
myseq.length(4);
for (CORBA::ULong i = 0; i < myseq.length(); i++)
myseq[i] = values[i]; // Deep copy
// Print current contents
for (CORBA::ULong j = 0; j < myseq.length(); j++)
cout << "myseq[" << j << "] = \"" << myseq[j].in() << "\"" << endl;
cout << endl;
// Change second element (deallocates "second")
myseq[1] = CORBA::string_dup("second element");
文章来源于领测软件测试网 https://www.ltesting.net/