Skip to content

Latest commit

 

History

History
39 lines (22 loc) · 1.28 KB

CppContainerToStr.md

File metadata and controls

39 lines (22 loc) · 1.28 KB

 

 

 

 

 

 

ContainerToStr is a container and convert code snippet to convert a container to std::string.

 


#include <sstream> template <class Container> const std::string ContainerToStr(const Container& c, const std::string& seperator = " ") {   std::stringstream s;   std::copy(c.begin(),c.end(),     std::ostream_iterator<typename Container::value_type>(s,seperator.c_str()));   return s.str(); }