C++ fixed length string class?

前端 未结 10 1116
遇见更好的自我
遇见更好的自我 2020-12-17 17:56

Is there anything like this in Standard C++ / STL? Ideally it should be constructed like

fstring s = fstring(10);

I need to sometimes cons

10条回答
  •  别那么骄傲
    2020-12-17 18:41

    With ISO C++ +17 you can do this

    #include 
    ......
    char dataBuffer[BUFF_SIZE];
    auto commandString = std::string_view{ dataBuffer };
    ......
    

提交回复
热议问题