Boost logo

Boost Users :

From: gast128 (gast128_at_[hidden])
Date: 2007-09-25 04:55:41


Dear all

I was requesting an 'erase_if' a while ago, and now I ran into a 'replace_if'
problem. So after spendig 2 hours in the documentation, I finally found on www
('[string_algo] replace repeated char with single instance?') that one should
use the 'find_format_all':

boost::find_format_all(str, boost::token_finder(boost::is_any_of("ab")),
boost::const_formatter("c"));

But wouldn't it be better to make a 'replace_if' shortcut solely for the
purpose of documentation reasons:

boost::replace_all_if(str, boost::is_any_of("ab"), "c");

I think that most people find the last line easier to read and comprehend than
its (more powerful) 'find_format' cousin. The string_algo library is nice but
I get lost more than once. Especially find, replace, erease with predicates
are often used by us. However direct use seems not possible.

wkr,
me


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net