Skip to content

Commit

Permalink
Fix for #198.
Browse files Browse the repository at this point in the history
GCC-4.2.1 is unable to compile code like this:

    std::vector<int> v;
    std::vector<int>::const_reverse_iterator i;
    for (i = v.rbegin(); i != v.rend(); ++i) ;

It's unable to deduce const overload for 'rend':

    "no match for ‘operator!=’ in ‘i != std::vector<_Tp, _Alloc>::rend()"

However, the following code compiles fine:

    std::vector<int> v;
    std::vector<int>::const_reverse_iterator i = v.rbegin(), e = v.rend();
    for (i != e; ++i) ;

This was reported by Ryan Shmidt.
  • Loading branch information
skvadrik committed Nov 8, 2017
1 parent e313dd2 commit 5b95c8e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions re2c/src/code/bitmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ bitmaps_t::~bitmaps_t()

void bitmaps_t::insert(const Go *go, const State *s)
{
for (rciter_t i = maps.rbegin(); i != maps.rend(); ++i) {
rciter_t i = maps.rbegin(), e = maps.rend();
for (; i != e; ++i) {
if (matches(i->go, i->on, go, s)) return;
}

Expand All @@ -37,7 +38,8 @@ void bitmaps_t::insert(const Go *go, const State *s)

const bitmap_t *bitmaps_t::find(const Go *go, const State *s) const
{
for (rciter_t i = maps.rbegin(); i != maps.rend(); ++i) {
rciter_t i = maps.rbegin(), e = maps.rend();
for (; i != e; ++i) {
if (i->on == s && matches(i->go, i->on, go, s)) return &(*i);
}
return NULL;
Expand Down

0 comments on commit 5b95c8e

Please sign in to comment.