ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
Re: [boost] Interest for a perl6-like-junctions-class?
by Jeff Flinn other posts by this author
Jul 28 2005 1:30PM messages near this date
Re: [boost] null | [boost] [1.33.0] Branch for release
SOURCE 
"Rob Stewart" <stewart@[...].com>  wrote in message 
news:200507281901.j6SJ1Z0F011364@[...]..
>  From: "Jeff Flinn" <TriumphSprint2000@[...].com>
> >
> > 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?

I agree it does read better.

Using a less operator intensive approach would yield:

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

or

    all( aName, is_not_any_of(" -") );


Either way I think it would be worthwhile to get Pavol's feedback here. He's 
obviously dealt with many of the same issues that are being discussed in 
this thread. It may make more sense to collaborate on introducing these 
facilities. Either the string algorithm library could be used as a basis for 
a junction library, possibly the junction library would be provided as an 
enhancement to the string algorithm library.

Jeff Flinn 



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved