Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-07-28 14:01:35


From: "Jeff Flinn" <TriumphSprint2000_at_[hidden]>
>
> I just found this snippet of code in one of my projects:
>
> #include <boost/algorithm/string.hpp>
> #include <boost/algorithm/string/classification.hpp>
>
> bool NameValid( const std::string& aName )
> {
> using namespace boost::algorithm;
>
> return all( aName, !is_any_of(" -") );;
> }
>
> looks familiar eh? I totally forgot about this. I haven't looked in Pavol
> Droba's string algorithm library to see if there are additional facilities
> that cover other cases. The 'string' in Pavol's library defines string as a
> general concept and not as std::string.

That expression would be easier to read with the junctions idea:

   none_of(aName) == any_of(" -");

(Assuming all of the above syntax can be made to work!)

Don't you agree?

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk