[Boost-bugs] [Boost C++ Libraries] #7775: Allow algorithm::join to accept a container of char*

Subject: [Boost-bugs] [Boost C++ Libraries] #7775: Allow algorithm::join to accept a container of char*
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-12-08 11:17:01


#7775: Allow algorithm::join to accept a container of char*
--------------------------------------------+-------------------------------
 Reporter: Sergey Mitsyn <svm at jinr.ru> | Owner: marshall
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: algorithm
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
--------------------------------------------+-------------------------------
 Sometimes it would be nice to join strings in this way:

 {{{
 const char *names[] = {"Jane", "John", "Kate", "Kyle"};

 std::cout << boost::algorithm::join(names, ", ") << std::endl;
 }}}

 Can join be fixed to accept char*[]?

 I think that one possible change would be in using a wrapper for a
 range_value<> that would return std::basic_string for a
 range_value<>::type which is a T* and range_value<>::type if it is
 something else. Anyway invoking join with a range value of T* with T not
 representing a character data is erroneous.

 Another option is to use the result of evaluation of
 operator+(range_value, separator) - so a user can pass std::string in the
 case above to make it valid, but I'm not sure if this is possible and/or
 portable.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7775>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC