[Boost-bugs] [Boost C++ Libraries] #2397: for_each: do not expose basic_string (implementation type)

Subject: [Boost-bugs] [Boost C++ Libraries] #2397: for_each: do not expose basic_string (implementation type)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-10-09 17:02:03


#2397: for_each: do not expose basic_string (implementation type)
--------------------------------------------------+-------------------------
 Reporter: François Barel <frabar666_at_[hidden]> | Owner: djowel
     Type: Feature Requests | Status: new
Milestone: Boost 1.37.0 | Component: spirit
  Version: Boost 1.36.0 | Severity: Problem
 Keywords: spirit2 symbols for_each |
--------------------------------------------------+-------------------------
 {{{symbols<Char,T>::for_each}}}'s argument currently accepts two args:
   {{{(basic_string<Char>& str, T& val)}}}

 [[br]]

 I know it's a slight interface change, but I think it should be changed
 to:
   {{{(Char const* str, T& val)}}}
 (i.e. change {{{s}}} into {{{s.c_str()}}} in {{{f}}} calls in
 {{{tst_map.hpp}}} and {{{detail/tst.hpp}}}), since:

 1. if I'm not mistaken the API is {{{Char const*}}} everywhere else anyway
 (and {{{basic_string}}} is only used internally as a {{{for_each}}}
 implementation detail, but is not exposed anywhere else),

 2. it lets the user do:
 {{{
         sym1.for_each(symX.add);
         sym2.for_each(symX.add);
         sym3.for_each(symX.add);
         ...
 }}}
 to merge multiple symbol tables together, which is nicer than having to
 write a one-line functor around {{{symX.add}}} just to do the required
 {{{c_str}}} call.

 Thanks,
 François

-- 
Ticket URL: <http://svn.boost.org/trac/boost/ticket/2397>
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:49:58 UTC