เข้ารหัส int8_t[]
ประเภทคือใช้แทน char[]
.
int8_t title[256] = {'a', 'e', 'w', 's'};
std::string s(title); // compile error: no corresponding constructor
วิธีที่เหมาะสมและสร้างกอย่างปลอดภัย std::string
จากมัน?
ตอนที่ฉันจะทำ cout << s;
ฉันอยากให้มันพิมพ์ aews
เหมือนว่า char[]
ประเภทนผ่านไป constructor.