Use C++20 concepts to require constraints on template parameters (#1977)

This commit is contained in:
Rangi
2026-05-22 17:54:34 -04:00
committed by GitHub
parent 728bed39d5
commit dce14fd4b8
12 changed files with 64 additions and 27 deletions
+1
View File
@@ -95,6 +95,7 @@ static std::string readKeyword(int initial) {
}
template<uint32_t Base>
requires BaseV<Base>
static yy::parser::symbol_type readNumber(int initial, char const *prefix, char const *name) {
LexerStackEntry &context = lexerStack.back();
uint32_t number;
+4 -4
View File
@@ -310,8 +310,9 @@ static bool compareSymbols(SortedSymbol const &sym1, SortedSymbol const &sym2) {
< std::tie(sym2.addr, sym2_local, sym2.parentAddr, sym2_name);
}
template<typename CallbackFnT>
static void forEachSortedSection(SortedSections const &bankSections, CallbackFnT callback) {
static void forEachSortedSection(
SortedSections const &bankSections, Procedure<Section const &> auto callback
) {
for (Section const *sect : bankSections.zeroLenSections) {
for (Section const &piece : sect->pieces()) {
callback(piece);
@@ -411,8 +412,7 @@ static void writeSectionName(std::string const &name, FILE *file) {
}
}
template<typename CallbackFnT>
uint16_t forEachSection(SortedSections const &sectList, CallbackFnT callback) {
uint16_t forEachSection(SortedSections const &sectList, Procedure<Section const &> auto callback) {
uint16_t used = 0;
auto section = sectList.sections.begin();
auto zeroLenSection = sectList.zeroLenSections.begin();