Ignore:
Timestamp:
Nov 18, 2017, 1:38:49 PM (2 years ago)
Author:
nmedfort
Message:

Bug fix for Grep Engine + better bug fix for UnicodeSet?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/UCD/unicode_set.h

    r5739 r5740  
    159159        friend class boost::iterator_core_access;
    160160    public:
    161         quad_iterator(RunIterator runIterator, QuadIterator quadIterator)
    162             : mRunIterator(runIterator), mQuadIterator(quadIterator), mOffset(0) {}
     161        quad_iterator(RunIterator runIterator, RunIterator runEnd, QuadIterator quadIterator, QuadIterator quadEnd, const run_type_t type, const length_t remaining)
     162        : mRunIterator(runIterator)
     163        , mRunEnd(runEnd)
     164        , mQuadIterator(quadIterator)
     165        #ifndef NDEBUG
     166        , mQuadEnd(quadEnd)
     167        #endif
     168        , mType(type)
     169        , mRemaining(remaining) {}
    163170
    164171        void advance(unsigned n);
     
    173180
    174181        inline run_type_t type() const {
    175             return mRunIterator->first;
     182            return mType;
    176183        }
    177184
    178185        inline length_t length() const {
    179             return mRunIterator->second - mOffset;
     186            return mRemaining;
    180187        }
    181188
    182189        inline bitquad_t quad() const {
     190            assert (mQuadIterator != mQuadEnd);
    183191            return *mQuadIterator;
    184192        }
    185193
    186194        inline bool equal(const quad_iterator & other) const {
    187             return (mRunIterator == other.mRunIterator) && (mQuadIterator == other.mQuadIterator);
     195            const auto r = (mRunIterator == other.mRunIterator) && (mRemaining == other.mRemaining);
     196            assert (!r || (mQuadIterator == other.mQuadIterator));
     197            return r;
    188198        }
    189199
    190200    private:
    191         RunIterator     mRunIterator;
    192         QuadIterator    mQuadIterator;
    193         unsigned        mOffset;
     201        RunIterator         mRunIterator;   
     202        const RunIterator   mRunEnd;
     203        QuadIterator        mQuadIterator;       
     204        #ifndef NDEBUG
     205        const QuadIterator  mQuadEnd;
     206        #endif
     207        run_type_t          mType;
     208        length_t            mRemaining;
    194209    };
    195210
    196211    inline quad_iterator quad_begin() const {
    197         return quad_iterator(mRuns.cbegin(), mQuads.cbegin());
     212        return quad_iterator(mRuns.cbegin(), mRuns.cend(), mQuads.cbegin(), mQuads.cend(), std::get<0>(*mRuns.cbegin()), std::get<1>(*mRuns.cbegin()));
    198213    }
    199214
    200215    inline quad_iterator quad_end() const {
    201         return quad_iterator(mRuns.cend(), mQuads.cend());
     216        return quad_iterator(mRuns.cend(), mRuns.cend(), mQuads.cend(), mQuads.cend(), Empty, 0);
    202217    }
    203218
Note: See TracChangeset for help on using the changeset viewer.