Printing lists with commas C++

后端 未结 28 1789
时光取名叫无心
时光取名叫无心 2020-11-22 03:33

I know how to do this in other languages, but not C++, which I am forced to use here.

I have a Set of Strings that I\'m printing to out in a list, and they need a co

28条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 03:53

    Following should do:-

     const std::vector<__int64>& a_setRequestId
     std::stringstream strStream;
     std::copy(a_setRequestId.begin(), a_setRequestId.end() -1, std::ostream_iterator<__int64>(strStream, ", "));
     strStream << a_setRequestId.back();
    

提交回复
热议问题