//prototype
void Split(char c, vector <MyString> &outputVector) const
//partial code inside split function
// create new MyString object to push into output vector
MyString substr;
substr.mString = newString;
substr.mLength = size;
// push new item
outputVector.push_back(substr);
outputVector.push_back()
行をステップ実行すると、mString
データメンバーは保持されません。ベクターへベクターにpush_back構造体を挿入
//I have two constructors
MyString()
{
mString = NULL;
mLength = 0;
}
/*************************************************
* MyList copy constructor
* creates a deep copy of a MyString item
************************************************/
MyString(const MyString ©)
{
mString = new char[copy.mLength];
int i;
for(; i < copy.mLength; i++)
{ mString[i] = copy.mString[i]; }
mString[i] = '\0';
mLength = copy.mLength;
}
ようこそスタックオーバーフロー! ** [編集] **あなたの質問は[mcve]または[SSCCE(ショート、自己完結型、正しい例)](http://sscce.org) – NathanOliver
私たちに 'MyString'の定義を表示してください –
あなたは何ですか* MyString'クラスの[3,5または0のルール](http://en.cppreference.com/w/cpp/language/rule_of_three)に従ってください。標準の 'std :: string'クラスを使用しない理由はありますか? –