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
+4 -2
View File
@@ -32,6 +32,7 @@
%code {
#include <algorithm>
#include <concepts> // invocable
#include <inttypes.h>
#include <optional>
#include <stdio.h>
@@ -57,9 +58,10 @@
yy::parser::symbol_type yylex(); // Provided by lexer.cpp
template<typename NumCallbackFnT, typename StrCallbackFnT>
static auto handleSymbolByType(
std::string const &symName, NumCallbackFnT numCallback, StrCallbackFnT strCallback
std::string const &symName,
std::invocable<Expression const &> auto numCallback,
std::invocable<std::string const &> auto strCallback
) {
if (Symbol *sym = sym_FindScopedSymbol(symName); sym && sym->type == SYM_EQUS) {
return strCallback(*sym->getEqus());