WIP continue debugging this test...

Problem with the visitation is solved now.
But the tree is still not rebuilt properly
This commit is contained in:
Fischlurch 2013-04-13 04:30:04 +02:00
parent e610384376
commit 346acb1fec
2 changed files with 37 additions and 21 deletions

View file

@ -706,23 +706,37 @@ namespace lib {
class AddressExposingIter
: public lib::BoolCheckable<AddressExposingIter<IT> >
{
public:
typedef typename IT::value_type ** pointer;
typedef typename IT::value_type *& reference;
typedef typename IT::value_type * value_type;
private:
IT i_; ///< nested source iterator
mutable value_type currPtr_;
void
takeAddress()
{
if (i_.isValid())
currPtr_ = & (*i_);
else
currPtr_ = 0;
}
public:
typedef typename IT::value_type * value_type;
typedef typename IT::value_type ** pointer;
typedef typename IT::value_type *& reference;
/** AddressExposingIter is always created
* by wrapping an existing iterator.
*/
explicit
AddressExposingIter (IT srcIter)
: i_(srcIter)
{ }
{
takeAddress();
}
@ -730,22 +744,28 @@ namespace lib {
/* === lumiera forward iterator concept === */
value_type
/** @return address of the source iteraor's current result
* @warning exposing a reference to an internal pointer for sake of compatibility.
* Clients must not store that reference, but rather use it to initialise
* a copy. The internal pointer exposed here will be changed on increment.
*/
reference
operator*() const
{
return &(*i_);
return currPtr_;
}
typename IT::pointer
pointer
operator->() const
{
return i_.operator->();
return currPtr_;
}
AddressExposingIter&
operator++()
{
++i_;
takeAddress();
return *this;
}

View file

@ -233,13 +233,12 @@ namespace test {
}
}
ASSERT (0 == level);
if (1 >= path_.size())
{ // add first node at begin of tree visitation
path_.clear();
path_.push_back(nextNode);
return 0; // by convention, here the root is an implicitly pre-existing context
}
throw error::Logic("corrupted test data tree or tree visitation floundered");
// nextNode not found as child (i.e. fork) within current tree path
// --> start new tree path at root
path_.clear();
path_.push_back(nextNode);
return 0; // by convention, here the root is an implicitly pre-existing context
}
};
@ -366,9 +365,6 @@ namespace test {
TreeRebuilder reconstructed (depthFirst (AddressExposingIter<Node::ChildSeq>(eachElm (testWood))) >>= exploreChildren);
//////////////////TODO: problem is in WrappedSequence. The operator*() returns a ref, but AddressExposingIter returns a value
//////////////////TODO: solution idea: use a specialisation for AddressexposingIter in "depthFirst"
cout << reconstructed.children_.size() << "=?=" << testWood.size();
CHECK (reconstructed.children_ == testWood);
}