
<FlSt@gmx.de> wrote in message news:42E8800E.4030803@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