Skip to content

Commit 6196338

Browse files
author
Thomas Kiley
committed
Make the symbol_table_baset define the const iterators
Since the const iterators can use the base class directly, these are not pure virtual - so derived classes can still provide an entirely different mechanism for iterating over the symbols - though this is not currently used.
1 parent 4307ce3 commit 6196338

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

src/util/journalling_symbol_table.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ class journalling_symbol_tablet : public symbol_table_baset
140140
base_symbol_table.end(), [this](const irep_idt &id) { on_update(id); });
141141
}
142142

143+
using symbol_table_baset::begin;
144+
using symbol_table_baset::end;
145+
143146
const changesett &get_inserted() const
144147
{
145148
return inserted;

src/util/symbol_table.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,8 @@ class symbol_tablet : public symbol_table_baset
120120
return iteratort(internal_symbols.end());
121121
}
122122

123-
typedef symbolst::const_iterator const_iteratort;
124-
125-
virtual const_iteratort begin() const
126-
{
127-
return internal_symbols.begin();
128-
}
129-
130-
virtual const_iteratort end() const
131-
{
132-
return internal_symbols.end();
133-
}
123+
using symbol_table_baset::begin;
124+
using symbol_table_baset::end;
134125

135126
/// Check that the symbol table is well-formed
136127
void validate(const validation_modet vm = validation_modet::INVARIANT) const;

src/util/symbol_table_base.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ class symbol_table_baset
237237

238238
using const_iteratort = symbolst::const_iterator;
239239

240-
const_iteratort begin() const;
241-
const_iteratort end() const;
240+
virtual const_iteratort begin() const;
241+
virtual const_iteratort end() const;
242242
};
243243

244244
std::ostream &

src/util/symbol_table_builder.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ class symbol_table_buildert : public symbol_table_baset
8585
return base_symbol_table.end();
8686
}
8787

88+
using symbol_table_baset::begin;
89+
using symbol_table_baset::end;
90+
8891
/// Try to find the next free identity for the passed-in prefix in
8992
/// this symbol table.
9093
/// \remark

0 commit comments

Comments
 (0)