How to initialize an std::string with a length?

后端 未结 5 726
盖世英雄少女心
盖世英雄少女心 2020-12-30 02:29

If a string\'s length is determined at compile-time, how can I properly initialize it?

#include 
int length = 3;
string word[length]; //invalid         


        
5条回答
提交回复
热议问题