- 511 名前:デフォルトの名無しさん mailto:sage [2018/04/09(月) 19:06:25.54 ID:m9zaOBXx.net]
- 引数を参照とポインタでも試してみましたが結果は変わらなかったです
void test3(std::string& str, ...) { const char* cstr = str.c_str(); ・・・ void test4(std::string* str, ...) { const char* cstr = str->c_str(); ・・・ void main() { ・・・ std::string str3("hello3 %d\n"); test3(str3, 123); std::string str4("hello4 %d\n"); test4(&str4, 123); } //結果 //hello1 123 //hello2 1819043176 //hello3 1819043176 //hello4 1819043176
|

|