Sunday 15 July 2012

c++ - A good example for boost::algorithm::join -


I just wanted to use but I could not find any usage examples and I did not want to invest in a lot of time To use this function to learn the Boost Range Library,

Can you provide a good example for using a string to be included in the container? Thank you.

  #include < Boost / algorithm / string / join.hpp & gt; #include & lt; Vector & gt; # Include & lt; Iostream & gt; Int main () {std :: vector & lt; Std :: string & gt; List; List.push_back ("hello"); List.push_back ("world!"); Std :: string join = boost :: algorithm :: join (list, ","); Std :: cout & lt; & Lt; & Lt; & Lt; Std :: endl; }  

Output:

  Hello, world!  

No comments:

Post a Comment