Opened 14 years ago

Closed 14 years ago

#2397 closed Feature Requests (fixed)

for_each: do not expose basic_string (implementation type)

Reported by: François Barel <frabar666@…> Owned by: Joel de Guzman
Milestone: Boost 1.37.0 Component: spirit
Version: Boost 1.36.0 Severity: Problem
Keywords: spirit2 symbols for_each Cc:

Description

symbols<Char,T>::for_each's argument currently accepts two args:

(basic_string<Char>& str, T& val)


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),
  1. 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

Change History (1)

comment:1 by François Barel <frabar666@…>, 14 years ago

Resolution: fixed
Status: newclosed

Solved in Spirit2X SVN (r1090)

Note: See TracTickets for help on using tickets.