How can I format a std::string using a collection of arguments?

后端 未结 3 1476

Is it possible to format std::string passing a set of arguments?

Currently I am formatting the string this way:

string helloString = \"Hello         


        
3条回答
  •  故里飘歌
    2021-02-07 08:15

    The boost::format library might be of interest if you want to avoid having to manually deal with the output buffer.

    As for taking the plain vector as input, what would you want to happen if tokens.size()<2? Wouldn't you have to ensure that the vector was big enough to index elements 0 and 1 in any case?

提交回复
热议问题