Lumiera Forward Iterators: remove support for post-increment

This commit is contained in:
Fischlurch 2012-01-08 01:14:36 +01:00
parent 8de4ecc8ac
commit d732e7e211
5 changed files with 48 additions and 68 deletions

View file

@ -191,15 +191,6 @@ namespace lib {
return *this; return *this;
} }
IterAdapter
operator++(int)
{
_maybe_throw();
IterAdapter oldPos(*this);
iterate();
return oldPos;
}
bool bool
isValid () const isValid () const
{ {
@ -334,13 +325,6 @@ namespace lib {
return *this; return *this;
} }
RangeIter
operator++(int)
{
_maybe_throw();
return RangeIter (p_++,e_);
}
bool bool
isValid () const isValid () const
{ {
@ -551,12 +535,6 @@ namespace lib {
return *this; return *this;
} }
PtrDerefIter
operator++(int)
{
return PtrDerefIter (i_++);
}
bool bool
isValid () const isValid () const
{ {

View file

@ -236,7 +236,6 @@ namespace session {
public: public:
P<TAR> operator* () { return ptr; } P<TAR> operator* () { return ptr; }
bool hasNext () { return next || findNext(); } bool hasNext () { return next || findNext(); }
Iter operator++ (int) { Iter tmp=*this; operator++(); return tmp; }
Iter& operator++ () Iter& operator++ ()
{ {
ptr=findNext(); ptr=findNext();

View file

@ -172,33 +172,33 @@ namespace test {
{ {
Iter13 i (reg_->candidates(Q13 ("irrelevant query"))); Iter13 i (reg_->candidates(Q13 ("irrelevant query")));
CHECK ( i.hasNext()); CHECK ( i.hasNext());
CHECK ( *i++ == o1); // ordered according to the degree of the queries CHECK ( *i == o1); ++i; // ordered according to the degree of the queries
CHECK ( *i++ == o2); CHECK ( *i == o2); ++i;
CHECK ( *i++ == o3); CHECK ( *i == o3); ++i;
CHECK ( *i++ == o3); CHECK ( *i == o3); ++i;
CHECK ( *i++ == o2); CHECK ( *i == o2); ++i;
CHECK ( *i == o1); CHECK ( *i == o1);
CHECK (!i.hasNext()); CHECK (!i.hasNext());
CHECK (! *++i ); // null after end CHECK (! *++i ); // null after end
i = reg_->candidates(q3); i = reg_->candidates(q3);
CHECK ( *i++ == o3); // found by direct match CHECK ( *i == o3); ++i; // found by direct match
CHECK ( *i++ == o1); // followed by the ordered enumeration CHECK ( *i == o1); ++i; // followed by the ordered enumeration
CHECK ( *i++ == o2); CHECK ( *i == o2); ++i;
CHECK ( *i++ == o3); CHECK ( *i == o3); ++i;
CHECK ( *i++ == o3); CHECK ( *i == o3); ++i;
CHECK ( *i++ == o2); CHECK ( *i == o2); ++i;
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK (!i.hasNext()); CHECK (!i.hasNext());
i = reg_->candidates(Q13()); i = reg_->candidates(Q13());
CHECK ( *i++ == o1); // found by direct match to the empty query CHECK ( *i == o1); ++i; // found by direct match to the empty query
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK ( *i++ == o2); CHECK ( *i == o2); ++i;
CHECK ( *i++ == o3); CHECK ( *i == o3); ++i;
CHECK ( *i++ == o3); CHECK ( *i == o3); ++i;
CHECK ( *i++ == o2); CHECK ( *i == o2); ++i;
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK (!i.hasNext()); CHECK (!i.hasNext());
uint d=0; uint d=0;
@ -230,12 +230,12 @@ namespace test {
Iter13 i (reg_->candidates(q4)); Iter13 i (reg_->candidates(q4));
CHECK ( i.hasNext()); CHECK ( i.hasNext());
CHECK ( *i++ == o1); // ordered according to the degree of the queries CHECK ( *i == o1); ++i; // ordered according to the degree of the queries
// but the o2 entries are missing // but the o2 entries are missing
CHECK ( *i++ == o3); CHECK ( *i == o3); ++i;
CHECK ( *i++ == o3); CHECK ( *i == o3); ++i;
// missing // missing
CHECK ( *i == o1); CHECK ( *i == o1);
CHECK (!i.hasNext()); CHECK (!i.hasNext());
o3.reset(); // killing the only reference.... o3.reset(); // killing the only reference....
@ -243,33 +243,33 @@ namespace test {
i = reg_->candidates(Q13 ("something")); i = reg_->candidates(Q13 ("something"));
CHECK ( i.hasNext()); CHECK ( i.hasNext());
CHECK ( *i++ == o1); // ordered according to the degree of the queries CHECK ( *i == o1); ++i; // ordered according to the degree of the queries
// but now also the o3 entries are missing... // but now also the o3 entries are missing...
CHECK ( *i == o1); CHECK ( *i == o1);
CHECK (!i.hasNext()); CHECK (!i.hasNext());
CHECK ( reg_->put (o1, q5)); // trying to register the same object at the same place CHECK ( reg_->put (o1, q5)); // trying to register the same object at the same place
// doesn't change anything (but counts as "success") // doesn't change anything (but counts as "success")
i = reg_->candidates(q5); i = reg_->candidates(q5);
CHECK ( *i++ == o1); // direct match CHECK ( *i == o1); ++i; // direct match
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK (!i.hasNext()); CHECK (!i.hasNext());
CHECK (!reg_->put (o2, q5)); // trying to (re)register o2 with a existing query CHECK (!reg_->put (o2, q5)); // trying to (re)register o2 with a existing query
// counts as failure (nothing changes) // counts as failure (nothing changes)
i = reg_->candidates(q5); i = reg_->candidates(q5);
CHECK ( *i++ == o1); // direct match CHECK ( *i == o1); ++i; // direct match
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK (!i.hasNext()); CHECK (!i.hasNext());
CHECK ( reg_->put (o2, q2)); // trying to (re)register o2 with another query succeeds CHECK ( reg_->put (o2, q2)); // trying to (re)register o2 with another query succeeds
i = reg_->candidates(q2); i = reg_->candidates(q2);
CHECK ( *i++ == o2); // direct match CHECK ( *i == o2); ++i; // direct match
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK ( *i++ == o2); // inserted here in the dataset CHECK ( *i == o2); ++i; // inserted here in the dataset
CHECK ( *i++ == o1); CHECK ( *i == o1); ++i;
CHECK (!i.hasNext()); CHECK (!i.hasNext());
CHECK ( reg_->forget (o1)); CHECK ( reg_->forget (o1));

View file

@ -84,8 +84,8 @@ namespace test {
// "calculation streams" for the individual // "calculation streams" for the individual
// Channels to be output through this slot. // Channels to be output through this slot.
OutputSlot::OpenedSinks sinks = alloc.getOpenedSinks(); OutputSlot::OpenedSinks sinks = alloc.getOpenedSinks();
DataSink sink1 = *sinks++; DataSink sink1 = *sinks;
DataSink sink2 = *sinks++; DataSink sink2 = *++sinks;
// within the frame-calculation "loop" // within the frame-calculation "loop"
// we perform an data exchange cycle // we perform an data exchange cycle
@ -127,12 +127,12 @@ namespace test {
DiagnosticOutputSlot::OutFrames stream1 = checker.getChannel(1); DiagnosticOutputSlot::OutFrames stream1 = checker.getChannel(1);
CHECK ( stream0); CHECK ( stream0);
CHECK (*stream0++ == testData(0,0)); CHECK (*stream0 == testData(0,0)); ++stream0;
CHECK (!stream0); CHECK (!stream0);
CHECK ( stream1); CHECK ( stream1);
CHECK (*stream1++ == testData(1,0)); CHECK (*stream1 == testData(1,0)); ++stream1;
CHECK (*stream1++ == testData(1,1)); CHECK (*stream1 == testData(1,1)); ++stream1;
CHECK (!stream1); CHECK (!stream1);
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #819 #if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #819
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #819 #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #819

View file

@ -215,7 +215,10 @@ namespace test{
// now for example the client could.... // now for example the client could....
while ( range ) while ( range )
cout << "::" << *range++; {
cout << "::" << *range;
++range;
}
cout << endl; cout << endl;
CHECK (isnil (range)); CHECK (isnil (range));
@ -317,7 +320,7 @@ namespace test{
TestContainer::ref_iterator rI (elms.begin_ref()); TestContainer::ref_iterator rI (elms.begin_ref());
CHECK (0 == *rI ); CHECK (0 == *rI );
CHECK (0 == *rI++); ++rI;
CHECK (1 == *rI ); CHECK (1 == *rI );
CHECK (2 == *++rI); CHECK (2 == *++rI);