Skip to content
Snippets Groups Projects
Commit cfaff40a authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Repaired bug introduced in deb37dbc; now tests pass

parent 50b7835e
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,6 @@
#include "defs.hpp"
#include <cmath>
#include <algorithm>
#include "olf.hpp"
#include "ptr.hpp"
......@@ -34,7 +33,9 @@ namespace NSel {
const vector<int> selD()
{
vector<int> ret;
copy_if( FSel.begin(), FSel.end(), ret.begin(), [](int k){ return P2D(NOlm::mem_get(k)); } );
for( int k: FSel )
if( P2D(NOlm::mem_get(k)) )
ret.push_back( k );
return ret;
}
......@@ -42,7 +43,9 @@ namespace NSel {
const vector<int> selC()
{
vector<int> ret;
copy_if( FSel.begin(), FSel.end(), ret.begin(), [](int k){ return P2C(NOlm::mem_get(k)); } );
for( int k: FSel )
if( P2C(NOlm::mem_get(k)) )
ret.push_back( k );
return ret;
}
......
......@@ -28,7 +28,9 @@ FileIterator::FileIterator( const vector<int>& _Sel, bool tolerate_empty )
}
POlo FileIterator::get()
{ if ( !going() )
{
cout << "DEBUG 1\n";
if ( iV>=Sel.size() )
return POlo();
int k=Sel[iV];
if( k<0 )
......@@ -36,19 +38,26 @@ POlo FileIterator::get()
if( k>=NOlm::mem_size() )
throw "FileSelection["+S(iV)+"]="+S(k)+" exceeds online memory size "+S(NOlm::mem_size());
++iV;
cout << "DEBUG 2\n";
return NOlm::mem_get(k);
}
POld FileIterator::getD()
{
if( POld ret = P2D(get()) )
POlo f = get();
if( !f )
return POld();
if( POld ret = P2D(f) )
return ret;
throw S("BUG: non-D file found by D iterator");
}
POlc FileIterator::getC()
{
if( POlc ret = P2C(get()) )
POlo f = get();
if( !f )
return POlc();
if( POlc ret = P2C(f) )
return ret;
throw S("BUG: non-C file found by C iterator");
}
......@@ -14,7 +14,6 @@ class FileIterator {
private:
int iV;
vector<int> Sel;
bool going() const { return iV<Sel.size(); }
public:
FileIterator( const vector<int>& _Sel, bool tolerate_empty=false );
void reset() { iV = 0; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment