Boost logo

Boost :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2005-07-28 11:10:56


<FlSt_at_[hidden]> wrote in message news:42E8800E.4030803_at_gmx.de...
> >
>>
>>>>>[...]
>>>>>
>>If that is a useful expression, it's more of a set operation than
>>a junction operation (as exemplified by Perl's junctions) anyway,
>>
> http://www.linux-magazine.com/issue/38/Perl_BlackJack.pdf.
> This is the article from where my idea comes to have something similar
> in C++ (I read the German translation in Linux Magazin 12/2003)
>
>>right? Besides, normal algorithms can be used to express that
>>quite succinctly. Do you need a new type for it? Maybe. I
>>don't think it should be merged with the simpler ideas from Perl
>>junctions. I think they are orthogonal behaviors, and the
>>complexity argues against one type doing both tasks.
>>
>>
> The Perl junctions aren't simpler, in Perl you can call functions either
> in a scalar context or in a list context. The called function can
> determine in which context it is called and return a scalar or a list. I
> think my mistake was, I tried to bring this concept into C++ for
> junctions, but it doesn't fit into the C++ type system. And there was no
> example for this in the article I denoted in my first message.
>
> A junction without junction result type and arithmetic operations is
> something completely different I had in mind at the beginning of this
> discussion. What remains now at the view point of the client are the
> four functions any_of<T>, all_of<T>, one_of<T> and none_of<T> and the
> comparison operators. The XXX_of functions should operate on ranges or
> containers. I aggree.

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.

Jeff Flinn


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