Skip to content

Commit 736b397

Browse files
martinThomas Kiley
martin
authored and
Thomas Kiley
committed
Add an interface to iterate over symbol tables.
Patch originally by Chris Ryder.
1 parent c87b32e commit 736b397

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/util/symbol_table_base.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ void symbol_table_baset::show(std::ostream &out) const
6060
out << symbols.at(name);
6161
}
6262

63+
symbol_table_baset::const_iteratort symbol_table_baset::end() const
64+
{
65+
return symbols.end();
66+
}
67+
68+
symbol_table_baset::const_iteratort symbol_table_baset::begin() const
69+
{
70+
return symbols.begin();
71+
}
72+
6373
/// Print the contents of the symbol table.
6474
/// \param out: The ostream to direct output to
6575
/// \param symbol_table: The symbol table to print out

src/util/symbol_table_base.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ class symbol_table_baset
234234

235235
virtual iteratort begin() = 0;
236236
virtual iteratort end() = 0;
237+
238+
using const_iteratort = symbolst::const_iterator;
239+
240+
const_iteratort begin() const;
241+
const_iteratort end() const;
237242
};
238243

239244
std::ostream &

0 commit comments

Comments
 (0)