diff --git a/pub/lib/fsel.cpp b/pub/lib/fsel.cpp index db2ccfc5f360c643b958ab68916cbd0f230b1b0e..23c1521c9f4ea07be5f794342a49e866ac468e3d 100644 --- a/pub/lib/fsel.cpp +++ b/pub/lib/fsel.cpp @@ -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; } diff --git a/pub/lib/loop.cpp b/pub/lib/loop.cpp index 175d451a8d841e5b876561d2a62f6b8a222a155f..4f1e172d7ef8785c90ffd34d141dc78682491abf 100644 --- a/pub/lib/loop.cpp +++ b/pub/lib/loop.cpp @@ -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"); } diff --git a/pub/lib/loop.hpp b/pub/lib/loop.hpp index 2d6492215244118606c0530c357ff752b514a052..a4262b5b290592a7fb6a024f23d79f12629a9d6b 100644 --- a/pub/lib/loop.hpp +++ b/pub/lib/loop.hpp @@ -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; }