Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-08-10 08:39:47

From: Florian Stegner <FlSt_at_[hidden]>
> Rob Stewart wrote:
> > From: Matthew Vogt <mattvogt_at_[hidden]>
> >>Matthew Vogt wrote:
> >>
> > I've uploaded yet another revision of I decided
> > to go with "some" for n_m/subrange/subset/i_j/a_z/x_y/etc
> I aggree with it. But each_of is still confusing for me. You
> implemented it as the negation of all_of: "( all_of( a ) > x ) != (
> each_of( x ) > x )" is true for all a and x. each_of in your
> implementation is equivalent to not_all_of in mine. not_all_of in your
> implementation is the negation of one_of, what is ok. But each_of( a )
> == x means that none or more but not all elements of a are equal to x.
> There must be a better name as each_of. I had just a quick look on your
> new implementation. I will post my results later.

I just took a look at my implementation of all and each. At
least in my latest version, it's worse than you describe. They
are identical. Regardless of how I've implemented them, these
are the intended semantics:

   all: all of the values must match *the same* other value

   each: all of the values must match *some* other value

Thus, all_of({1, 2, 3}) < any_of({3, 4}) means:

   1 < 3: true
   2 < 3: true
   3 < 3: false
   1 < 4: true
   2 < 4: true
   3 < 4: true
   result: true

But, each_of({1, 2, 3}) < any_of({3, 4}) means:

   1 < 3: true
   2 < 3: true
   3 < 3: false
   3 < 4: true
   result: true

> Could you send me the testfiles .cpp or upload them to the sandbox file
> vault?

Oops! I'll do that tonight.

> Then I could help you to complete them. What is about the tests
> for the relations between the multivalues I sent you?

I'm not sure I understand the question. Are you asking if I ran
your tests? No, I didn't.

> > There are still some things missing:
> >
> > - tests for some_of, between, and exactly.
> I found also relations between expressions with one_of.

Are you saying they were missing from your tests? (They are in
the missing tests.hpp.)

> > - support for user-defined predicates that only know how to
> > compare to values and not multivalues
> My implementation (v11) can compare two multivalues (junctions) with
> user defined predicates. I wrote swap_operands as a function object
> wrapper, if the rhs-parameter is a multivalue. There is still the
> problem with lambda-expressions. The only working idea I found to allow

That's what I've been working on. I'll have a look.

> the usage of lambda expressions would be to have a function like this:
> compare( all_of( a ), _1 < _2, any_of( b ) )
> But what is about the []-operator?
> all_of( a ) [ _2 > _1 ] any_of( b )
> Then we would have no more problems with operator precendence. :-)

That won't work. "all_of(a)::operator [](_2 > _1)" yields an
object, but you end up with "result any_of(b)," where "result" is
the object returned by operator [].

> > - documentation
> I will help you so good I can.

I know it will be a challenge given that English isn't your
native language. The Boolean logic is certainly one area I'll
need your help. We can also discuss--privately, I think--the
layout and outline.

> > If there is reasonable consensus for what we have thus far, among
> > those interested in this library, I think we should start to work
> > on some documentation so more people will take a look at the
> > library.
> There is a boost-sandbox CVS. Now after we have a common version ( Now
> it makes no sense develop my prototype further ) this would be a good
> place for our library. Or is the stage to early?

I think we should have some documentation first. Don't you

Rob Stewart                           stewart_at_[hidden]
Software Engineer           
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at, gregod at, cpdaniel at, john at